Skip to content

Commit dfff3cd

Browse files
committed
[User] Add toogable setting to log user in after signup - #9
Automatic commit for getparthenon/monorepo@4695017
1 parent e2be6ad commit dfff3cd

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

assets/store/user.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ const actions = {
5858
},
5959
signup({ dispatch, commit }, user) {
6060
commit('signupRequest', user);
61-
61+
},
62+
markAsLoggedin({commit}, {user}) {
63+
localStorage.setItem('user', JSON.stringify(user));
64+
commit('loginSuccess', user);
6265
}
66+
6367
};
6468

6569
const mutations = {

assets/views/Public/Signup.vue

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@
6060
<script>
6161
import {userservice} from "../../services/userservice";
6262
import PublicLogo from "../../components/public/PublicLogo";
63+
import {mapActions} from "vuex";
6364
6465
export default {
6566
name: "Signup",
@@ -81,7 +82,7 @@ export default {
8182
}
8283
},
8384
methods: {
84-
85+
...mapActions('userStore', ['markAsLoggedin']),
8586
handleSubmit (e) {
8687
this.submitted = true;
8788
const { email, password, password_confirm } = this;
@@ -111,12 +112,18 @@ export default {
111112
}
112113
113114
this.in_process = true
114-
115+
var that = this
115116
if (email && password) {
116117
userservice.signup(user, this.$route.params.code)
117118
.then(
118-
user => {
119+
response => {
120+
119121
this.signing_up = false
122+
if (response.data.user !== undefined) {
123+
that.$router.push({name: 'app.home'})
124+
}
125+
var user = response.data.user
126+
this.markAsLoggedin({user});
120127
},
121128
error => {
122129
this.error = error

0 commit comments

Comments
 (0)