
--- client/views/pages/AppStore.js
+++ client/views/pages/AppStore.js
... | ... | @@ -48,8 +48,15 @@ |
48 | 48 |
state.userId = null; |
49 | 49 |
state.roles = []; |
50 | 50 |
state.loginId = null; |
51 |
- state.isHandlingSessionError = false; |
|
52 | 51 |
}, |
52 |
+ setLoginSuccess(state, payload) { |
|
53 |
+ state.authorization = payload.token; // 토큰 저장 |
|
54 |
+ state.userId = payload.userId; // 사용자 ID 저장 |
|
55 |
+ state.loginId = payload.loginId; // 로그인 ID 저장 |
|
56 |
+ state.userNm = payload.userNm; // 사용자 이름 저장 |
|
57 |
+ state.roles = payload.roles; // 사용자 권한 저장 |
|
58 |
+ state.isHandlingSessionError = false; // <<<--- 로그인 성공 시 여기서 플래그를 false로 리셋!!! |
|
59 |
+ } |
|
53 | 60 |
}, |
54 | 61 |
actions: { |
55 | 62 |
async logout({ commit }) { |
--- client/views/pages/login/Login.vue
+++ client/views/pages/login/Login.vue
... | ... | @@ -67,19 +67,26 @@ |
67 | 67 |
|
68 | 68 |
if (response.status === 200) { |
69 | 69 |
const newToken = response.headers.authorization; |
70 |
- this.store.commit("setAuthorization", newToken); |
|
70 |
+ // this.store.commit("setAuthorization", newToken); |
|
71 | 71 |
|
72 | 72 |
// JWT 디코딩 |
73 | 73 |
const mbr = this.decodeJwt(newToken); |
74 | 74 |
if (mbr) { |
75 |
- this.store.commit("setUserId", mbr.userId); |
|
76 |
- this.store.commit("setLoginId", mbr.loginId); |
|
77 |
- this.store.commit("setUserNm", mbr.userNm); |
|
78 |
- this.store.commit("setRoles", mbr.roles); |
|
75 |
+ // this.store.commit("setUserId", mbr.userId); |
|
76 |
+ // this.store.commit("setLoginId", mbr.loginId); |
|
77 |
+ // this.store.commit("setUserNm", mbr.userNm); |
|
78 |
+ // this.store.commit("setRoles", mbr.roles); |
|
79 |
+ this.store.commit("setLoginSuccess", { |
|
80 |
+ token: newToken, |
|
81 |
+ userId: mbr.userId, |
|
82 |
+ loginId: mbr.loginId, |
|
83 |
+ userNm: mbr.userNm, |
|
84 |
+ roles: mbr.roles, |
|
85 |
+ }); |
|
79 | 86 |
} |
80 | 87 |
|
81 |
- // 아이디 저장 처리 |
|
82 |
- if (this.saveId) { |
|
88 |
+ // 아이디 저장 처리 |
|
89 |
+ if (this.saveId) { |
|
83 | 90 |
VueCookies.set('savedLoginId', this.member.loginId, '1d'); // 1일 동안 쿠키 저장 |
84 | 91 |
} else { |
85 | 92 |
VueCookies.remove('savedLoginId'); // 체크 해제 시 쿠키 삭제 |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?