
--- client/resources/api/index.js
+++ client/resources/api/index.js
... | ... | @@ -48,6 +48,7 @@ |
48 | 48 |
|
49 | 49 |
// 응답 상태가 200일 경우에만 처리 |
50 | 50 |
if (res.status === 200) { |
51 |
+ console.log("토큰 재발급 성공! 굿~"); |
|
51 | 52 |
// 새로 발급 받은 AccessToken 저장 |
52 | 53 |
store.commit('setAuthorization', res.headers.authorization); |
53 | 54 |
originalReq.headers.Authorization = store.state.authorization; // 새로 발급 받은 AccessToken을 기존 요청에 추가 |
--- client/views/App.vue
+++ client/views/App.vue
... | ... | @@ -36,6 +36,7 @@ |
36 | 36 |
|
37 | 37 |
if (res.status === 200) { |
38 | 38 |
// 새로 발급 받은 AccessToken 저장 |
39 |
+ console.log("토큰 재발급 성공! 굿~"); |
|
39 | 40 |
this.store.commit('setAuthorization', res.headers.authorization); |
40 | 41 |
// JWT 토큰 디코딩 |
41 | 42 |
const base64String = res.headers.authorization.split('.')[1]; |
--- client/views/pages/user/MyInfo.vue
+++ client/views/pages/user/MyInfo.vue
... | ... | @@ -149,13 +149,18 @@ |
149 | 149 |
alert("수정 할 내용이 없습니다."); |
150 | 150 |
} else { |
151 | 151 |
if (confirm("비밀번호 변경을 하시겠습니까?")) { |
152 |
- const response = await updatePassword(this.$store.state.userId, this.userPassword); |
|
153 |
- if (response.status == 200) { |
|
154 |
- this.resetForm(); |
|
155 |
- alert("비밀번호가 변경되었습니다."); |
|
156 |
- window.location.reload(); // 페이지 새로 고침 |
|
157 |
- } else { |
|
158 |
- alert("비밀번호 변경이 실패되었습니다."); |
|
152 |
+ try { |
|
153 |
+ const response = await updatePassword(this.$store.state.userId, this.userPassword); |
|
154 |
+ if (response.status === 200) { |
|
155 |
+ this.resetForm(); |
|
156 |
+ alert("비밀번호가 변경되었습니다."); |
|
157 |
+ window.location.reload(); // 페이지 새로 고침 |
|
158 |
+ } |
|
159 |
+ } catch (error) { |
|
160 |
+ if (error.response && error.response.status === 401) { |
|
161 |
+ alert("비밀번호 변경이 실패하였습니다."); |
|
162 |
+ window.location.reload(); // 페이지 새로 고침 |
|
163 |
+ } |
|
159 | 164 |
} |
160 | 165 |
} |
161 | 166 |
} |
... | ... | @@ -163,26 +168,36 @@ |
163 | 168 |
if (this.$store.state.userNm !== this.userInfo.userNm) { |
164 | 169 |
if (this.isValidationPasswdord()) { |
165 | 170 |
if (confirm("회원정보를 변경을 하시겠습니까?")) { |
166 |
- const response = await updateUsers(this.$store.state.userId, this.userInfo); |
|
167 |
- if (response.status == 200) { |
|
168 |
- this.$store.commit("setUserNm", this.userInfo.userNm); |
|
169 |
- this.resetForm(); |
|
170 |
- alert("회원정보가 변경되었습니다."); |
|
171 |
- window.location.reload(); // 페이지 새로 고침 |
|
172 |
- } else { |
|
173 |
- alert("회원정보가 변경이 실패되었습니다."); |
|
171 |
+ try { |
|
172 |
+ const response = await updateUsers(this.$store.state.userId, this.userInfo); |
|
173 |
+ if (response.status === 200) { |
|
174 |
+ this.$store.commit("setUserNm", this.userInfo.userNm); |
|
175 |
+ this.resetForm(); |
|
176 |
+ alert("회원정보가 변경되었습니다."); |
|
177 |
+ window.location.reload(); // 페이지 새로 고침 |
|
178 |
+ } |
|
179 |
+ } catch (error) { |
|
180 |
+ if (error.response && error.response.status === 401) { |
|
181 |
+ alert("회원정보 변경이 실패하였습니다."); |
|
182 |
+ window.location.reload(); // 페이지 새로 고침 |
|
183 |
+ } |
|
174 | 184 |
} |
175 | 185 |
} |
176 | 186 |
} else { |
177 | 187 |
if (confirm("회원과 비밀번호를 변경하시겠습니까?")) { |
178 |
- const res = await updateUsers(this.$store.state.userId, this.userInfo); |
|
179 |
- const response = await updatePassword(this.$store.state.userId, this.userPassword); |
|
180 |
- if (res.status == 200 && response.status == 200) { |
|
181 |
- this.resetForm(); |
|
182 |
- alert("회원과 비밀번호를 변경되었습니다."); |
|
183 |
- window.location.reload(); // 페이지 새로 고침 |
|
184 |
- } else { |
|
185 |
- alert("회원과 비밀번호 변경이 실패되었습니다."); |
|
188 |
+ try { |
|
189 |
+ const res = await updateUsers(this.$store.state.userId, this.userInfo); |
|
190 |
+ const response = await updatePassword(this.$store.state.userId, this.userPassword); |
|
191 |
+ if (res.status === 200 && response.status === 200) { |
|
192 |
+ this.resetForm(); |
|
193 |
+ alert("회원과 비밀번호를 변경되었습니다."); |
|
194 |
+ window.location.reload(); // 페이지 새로 고침 |
|
195 |
+ } |
|
196 |
+ } catch (error) { |
|
197 |
+ if (error.response && error.response.status === 401) { |
|
198 |
+ alert("회원 및 비밀번호 변경이 실패하였습니다."); |
|
199 |
+ window.location.reload(); // 페이지 새로 고침 |
|
200 |
+ } |
|
186 | 201 |
} |
187 | 202 |
} |
188 | 203 |
} |
... | ... | @@ -191,19 +206,24 @@ |
191 | 206 |
alert("수정 할 내용이 없습니다."); |
192 | 207 |
} else { |
193 | 208 |
if (confirm("비밀번호 변경을 하시겠습니까?")) { |
194 |
- const response = await updatePassword(this.$store.state.userId, this.userPassword); |
|
195 |
- if (response.status == 200) { |
|
196 |
- this.resetForm(); |
|
197 |
- alert("비밀번호가 변경되었습니다."); |
|
198 |
- window.location.reload(); // 페이지 새로 고침 |
|
199 |
- }else { |
|
200 |
- alert("비밀번호 변경이 실패되었습니다."); |
|
209 |
+ try { |
|
210 |
+ const response = await updatePassword(this.$store.state.userId, this.userPassword); |
|
211 |
+ if (response.status === 200) { |
|
212 |
+ this.resetForm(); |
|
213 |
+ alert("비밀번호가 변경되었습니다."); |
|
214 |
+ window.location.reload(); // 페이지 새로 고침 |
|
215 |
+ } |
|
216 |
+ } catch (error) { |
|
217 |
+ if (error.response && error.response.status === 401) { |
|
218 |
+ alert("비밀번호 변경이 실패하였습니다."); |
|
219 |
+ window.location.reload(); // 페이지 새로 고침 |
|
220 |
+ } |
|
201 | 221 |
} |
202 | 222 |
} |
203 | 223 |
} |
204 | 224 |
} |
205 | 225 |
} |
206 |
- }, |
|
226 |
+ } |
|
207 | 227 |
}, |
208 | 228 |
watch: {}, |
209 | 229 |
computed: { |
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?