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: "",
};
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) {