fix(Auth): fixed redirect
This commit is contained in:
parent
5e1d63289b
commit
3b704d2500
@ -86,15 +86,20 @@ export class AuthController {
|
|||||||
store.dispatch(setRelayMapAction(relayMap.map))
|
store.dispatch(setRelayMapAction(relayMap.map))
|
||||||
}
|
}
|
||||||
|
|
||||||
const visitedLink = getVisitedLink()
|
const currentLocation = window.location.hash.replace('#', '')
|
||||||
|
|
||||||
if (visitedLink) {
|
if (!Object.values(appPrivateRoutes).includes(currentLocation)) {
|
||||||
const { pathname, search } = visitedLink
|
// User did change the location to one of the private routes
|
||||||
|
const visitedLink = getVisitedLink()
|
||||||
|
|
||||||
return Promise.resolve(`${pathname}${search}`)
|
if (visitedLink) {
|
||||||
} else {
|
const { pathname, search } = visitedLink
|
||||||
// Navigate user in
|
|
||||||
return Promise.resolve(appPrivateRoutes.homePage)
|
return Promise.resolve(`${pathname}${search}`)
|
||||||
|
} else {
|
||||||
|
// Navigate user in
|
||||||
|
return Promise.resolve(appPrivateRoutes.homePage)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,8 @@ export const Login = () => {
|
|||||||
const redirectPath =
|
const redirectPath =
|
||||||
await authController.authAndGetMetadataAndRelaysMap(pubkey)
|
await authController.authAndGetMetadataAndRelaysMap(pubkey)
|
||||||
|
|
||||||
navigateAfterLogin(redirectPath)
|
if (redirectPath) navigateAfterLogin(redirectPath)
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
toast.error('Error capturing public key from nostr extension: ' + err)
|
toast.error('Error capturing public key from nostr extension: ' + err)
|
||||||
|
Loading…
Reference in New Issue
Block a user