release v2.0.0 #4
|
@ -121,11 +121,24 @@ export default defineComponent({
|
|||
if (quasar.platform.is.capacitor)
|
||||
await sessionStore.updateSession(14 * 24 * 60 * 60, mainStore.currentSession.token);
|
||||
// Redirect user to previous page, if any.
|
||||
const redirect =
|
||||
router.currentRoute.value.redirectedFrom || 'redirect' in router.currentRoute.value.query
|
||||
? { path: router.currentRoute.value.query.redirect as string }
|
||||
: mainRoute;
|
||||
|
||||
// there are different redirects possible:
|
||||
// 1. when explicitely entered
|
||||
// a) http://localhost:8080/ -> should be redirected to mainRoute
|
||||
// b) http://localhost:8080/in/user/settings -> should be redirected to in/user/settings
|
||||
// 2. when automatically logged out:
|
||||
// http://localhost:8080/login?redirect=/in/user/settings
|
||||
// -> should be redirected to in/user/settings
|
||||
var redirect;
|
||||
if (router.currentRoute.value.redirectedFrom) {
|
||||
redirect = router.currentRoute.value.redirectedFrom.path;
|
||||
if (redirect === '/') {
|
||||
redirect = mainRoute;
|
||||
}
|
||||
} else if ('redirect' in router.currentRoute.value.query) {
|
||||
redirect = { path: router.currentRoute.value.query.redirect as string };
|
||||
} else {
|
||||
redirect = mainRoute;
|
||||
}
|
||||
void router.push(redirect);
|
||||
} else {
|
||||
// Login failed, notify and reset form
|
||||
|
|
Loading…
Reference in New Issue