Skip to content

Commit

Permalink
Fix language redirect after sign up
Browse files Browse the repository at this point in the history
  • Loading branch information
szymsza committed Jan 24, 2022
1 parent d9f8b22 commit f8978ea
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 16 deletions.
10 changes: 5 additions & 5 deletions src/pages/Auth/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@
export default {
name: 'PageSignIn',
props: {
loginData: String,
},
data() {
return {
translationPrefix: 'auth.',
Expand Down Expand Up @@ -133,9 +130,12 @@ export default {
},
},
created() {
const loginData = localStorage.getItem('loginData');
// Auto login user with passed data (from registration page)
if (this.loginData) {
this.login(this.loginData);
if (loginData) {
localStorage.removeItem('loginData');
this.login(loginData);
}
},
};
Expand Down
16 changes: 6 additions & 10 deletions src/pages/Auth/SignUp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,13 @@ export default {
alerts: false,
})
.then(() => {
localStorage.setItem('loginData', JSON.stringify({
username: this.email,
password: this.password,
isSignUp: true,
}));
this.$bus.$emit('fullLoader', true);
this.$router.push({
name: 'auth.login',
params: {
loginData: JSON.stringify({
username: this.email,
password: this.password,
isSignUp: true,
}),
},
});
this.$router.push(this.$path('auth.login'));
})
.catch((data) => outputValidationErrors(data.response.data))
.finally(() => {
Expand Down
1 change: 0 additions & 1 deletion src/router/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const routes: RouteRecordRaw[] = [
alias: ENroutes.auth.login,
name: 'auth.login',
component: () => import('pages/Auth/Login.vue'),
props: true,
beforeEnter: notLoggedInMiddleware,
},
{
Expand Down

0 comments on commit f8978ea

Please sign in to comment.