
--- client/views/App.vue
+++ client/views/App.vue
... | ... | @@ -28,7 +28,7 @@ |
28 | 28 |
methods: { |
29 | 29 |
async refreshToken() { |
30 | 30 |
try { |
31 |
- const res = await apiClient.post("/refresh/tknReissue.json", {}, { |
|
31 |
+ const res = await axios.post("/refresh/tknReissue.json", {}, { |
|
32 | 32 |
headers: { |
33 | 33 |
"Content-Type": "application/json; charset=UTF-8", |
34 | 34 |
}, |
... | ... | @@ -36,7 +36,7 @@ |
36 | 36 |
|
37 | 37 |
if (res.status === 200) { |
38 | 38 |
// 새로 발급 받은 AccessToken 저장 |
39 |
- store.commit('setAuthorization', res.headers.authorization); |
|
39 |
+ this.store.commit('setAuthorization', res.headers.authorization); |
|
40 | 40 |
// JWT 토큰 디코딩 |
41 | 41 |
const base64String = res.headers.authorization.split('.')[1]; |
42 | 42 |
const base64 = base64String.replace(/-/g, '+').replace(/_/g, '/'); |
... | ... | @@ -44,8 +44,8 @@ |
44 | 44 |
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); |
45 | 45 |
}).join('')); |
46 | 46 |
const mbr = JSON.parse(jsonPayload); |
47 |
- store.commit("setUserNm", mbr.userNm); // 사용자 이름 저장 |
|
48 |
- store.commit('setRoles', mbr.roles); // 사용자 역할 저장 |
|
47 |
+ this.store.commit("setUserNm", mbr.userNm); // 사용자 이름 저장 |
|
48 |
+ this.store.commit('setRoles', mbr.roles); // 사용자 역할 저장 |
|
49 | 49 |
} else { |
50 | 50 |
alert('토큰 재발급 요청 실패'); |
51 | 51 |
this.$router.push('/login.page'); |
... | ... | @@ -53,7 +53,7 @@ |
53 | 53 |
} catch (error) { |
54 | 54 |
console.error("Refresh token error:", error); |
55 | 55 |
alert('세션이 종료되었습니다.\n로그인을 새로 해주세요.'); |
56 |
- store.commit("setStoreReset"); |
|
56 |
+ this.store.commit("setStoreReset"); |
|
57 | 57 |
this.$router.push('/login.page'); // 로그인 페이지로 리다이렉트 |
58 | 58 |
} |
59 | 59 |
}, |
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?