eleminate permanent spinner on login

This commit is contained in:
groegert 2021-12-26 12:00:08 +01:00
parent ec28857af5
commit e07df08822
1 changed files with 18 additions and 5 deletions

View File

@ -121,11 +121,24 @@ export default defineComponent({
if (quasar.platform.is.capacitor) if (quasar.platform.is.capacitor)
await sessionStore.updateSession(14 * 24 * 60 * 60, mainStore.currentSession.token); await sessionStore.updateSession(14 * 24 * 60 * 60, mainStore.currentSession.token);
// Redirect user to previous page, if any. // Redirect user to previous page, if any.
const redirect = // there are different redirects possible:
router.currentRoute.value.redirectedFrom || 'redirect' in router.currentRoute.value.query // 1. when explicitely entered
? { path: router.currentRoute.value.query.redirect as string } // a) http://localhost:8080/ -> should be redirected to mainRoute
: 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); void router.push(redirect);
} else { } else {
// Login failed, notify and reset form // Login failed, notify and reset form