redirect users after logging in

This commit is contained in:
Andreas Zweili 2021-07-29 17:20:11 +02:00
parent e16d5411d5
commit 77e7a7d93a
3 changed files with 6 additions and 1 deletions

View File

@ -30,6 +30,7 @@ export default {
methods: {
logout() {
this.$store.dispatch('logout');
this.$router.replace('/coaches');
}
}
};

View File

@ -80,6 +80,8 @@ export default {
} else {
await this.$store.dispatch('signup', actionPayload);
}
const redirectUrl = '/' + (this.$route.query.redirect || 'coaches');
this.$router.replace(redirectUrl);
} catch (error) {
this.error = error.message || 'Failed to authenticate, try later.';
}

View File

@ -16,7 +16,9 @@
<base-button mode="outline" @click="loadCoaches(true)"
>Refresh</base-button
>
<base-button link to="/auth" v-if="!isLogggedIn">Login</base-button>
<base-button link to="/auth?redirect=register" v-if="!isLogggedIn"
>Login to Register</base-button
>
<base-button
v-if="isLogggedIn && !isCoach && !isLoading"
link