fix(auth): correctly redirect the user to the last visited page after login
Resolves https://kolaente.dev/vikunja/frontend/issues/3682
This commit is contained in:
@ -1,6 +1,10 @@
|
||||
const LAST_VISITED_KEY = 'lastVisited'
|
||||
|
||||
export const saveLastVisited = (name: string, params: object, query: object) => {
|
||||
export const saveLastVisited = (name: string | undefined, params: object, query: object) => {
|
||||
if (typeof name === 'undefined') {
|
||||
return
|
||||
}
|
||||
|
||||
localStorage.setItem(LAST_VISITED_KEY, JSON.stringify({name, params, query}))
|
||||
}
|
||||
|
||||
@ -9,7 +13,7 @@ export const getLastVisited = () => {
|
||||
if (lastVisited === null) {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
return JSON.parse(lastVisited)
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user