File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -58,8 +58,12 @@ const actions = {
58
58
} ,
59
59
signup ( { dispatch, commit } , user ) {
60
60
commit ( 'signupRequest' , user ) ;
61
-
61
+ } ,
62
+ markAsLoggedin ( { commit} , { user} ) {
63
+ localStorage . setItem ( 'user' , JSON . stringify ( user ) ) ;
64
+ commit ( 'loginSuccess' , user ) ;
62
65
}
66
+
63
67
} ;
64
68
65
69
const mutations = {
Original file line number Diff line number Diff line change 60
60
<script >
61
61
import {userservice } from " ../../services/userservice" ;
62
62
import PublicLogo from " ../../components/public/PublicLogo" ;
63
+ import {mapActions } from " vuex" ;
63
64
64
65
export default {
65
66
name: " Signup" ,
@@ -81,7 +82,7 @@ export default {
81
82
}
82
83
},
83
84
methods: {
84
-
85
+ ... mapActions ( ' userStore ' , [ ' markAsLoggedin ' ]),
85
86
handleSubmit (e ) {
86
87
this .submitted = true ;
87
88
const { email , password , password_confirm } = this ;
@@ -111,12 +112,18 @@ export default {
111
112
}
112
113
113
114
this .in_process = true
114
-
115
+ var that = this
115
116
if (email && password) {
116
117
userservice .signup (user, this .$route .params .code )
117
118
.then (
118
- user => {
119
+ response => {
120
+
119
121
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});
120
127
},
121
128
error => {
122
129
this .error = error
You can’t perform that action at this time.
0 commit comments