1
0

chore: follow the happy path

This commit is contained in:
kolaente 2023-04-01 17:16:51 +02:00
parent 0ce150af23
commit a33e2f6c00
No known key found for this signature in database
GPG Key ID: F40E70337AB24C9B

View File

@ -7,7 +7,10 @@ export function useRedirectToLastVisited() {
function getLastVisitedRoute() { function getLastVisitedRoute() {
const last = getLastVisited() const last = getLastVisited()
if (last !== null) { if (last === null) {
return null
}
clearLastVisited() clearLastVisited()
return { return {
name: last.name, name: last.name,
@ -16,16 +19,13 @@ export function useRedirectToLastVisited() {
} }
} }
return null
}
function redirectIfSaved() { function redirectIfSaved() {
const lastRoute = getLastVisitedRoute() const lastRoute = getLastVisitedRoute()
if (lastRoute) { if (lastRoute) {
router.push(lastRoute) return router.push(lastRoute)
} }
router.push({name: 'home'}) return router.push({name: 'home'})
} }
return { return {