Fix redirection after login

Closes #1067

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2022-04-04 15:57:44 +02:00
parent 2e1c284565
commit 05648fc1f4
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -189,6 +189,8 @@ export default class Login extends Vue {
password: "",
};
redirect: string | undefined = "";
errors: string[] = [];
rules = {
@ -204,6 +206,7 @@ export default class Login extends Vue {
const { query } = this.$route;
this.errorCode = query.code as LoginErrorCode;
this.redirect = query.redirect as string | undefined;
}
async loginAction(e: Event): Promise<Route | void> {
@ -230,8 +233,8 @@ export default class Login extends Vue {
saveUserData(data.login);
await this.setupClientUserAndActors(data.login);
if (this.$route.query.redirect) {
this.$router.push(this.$route.query.redirect as string);
if (this.redirect) {
this.$router.push(this.redirect as string);
return;
}
if (window.localStorage) {