Merge branch 'redirect-after-login' into 'main'

Fix redirection after login

Closes #1067

See merge request framasoft/mobilizon!1201
This commit is contained in:
Thomas Citharel 2022-04-04 14:30:48 +00:00
commit 8e16c64989

View file

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