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: { methods: {
logout() { logout() {
this.$store.dispatch('logout'); this.$store.dispatch('logout');
this.$router.replace('/coaches');
} }
} }
}; };

View File

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

View File

@ -16,7 +16,9 @@
<base-button mode="outline" @click="loadCoaches(true)" <base-button mode="outline" @click="loadCoaches(true)"
>Refresh</base-button >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 <base-button
v-if="isLogggedIn && !isCoach && !isLoading" v-if="isLogggedIn && !isCoach && !isLoading"
link link