
--- client/views/pages/ctgry/CategoryManagement.vue
+++ client/views/pages/ctgry/CategoryManagement.vue
... | ... | @@ -30,7 +30,7 @@ |
30 | 30 |
</thead> |
31 | 31 |
<tbody> |
32 | 32 |
<tr v-if="selectedCategories.length === 0"> |
33 |
- <td colspan="3" style="text-align: center;">등록된 카테고리리가 없습니다.</td> |
|
33 |
+ <td colspan="3" style="text-align: center;">등록된 카테고리가 없습니다.</td> |
|
34 | 34 |
</tr> |
35 | 35 |
<tr v-for="item in selectedCategories" :key="item.ctgryId" |
36 | 36 |
:class="{ 'delete-member': item.useAt === 'N' }" @click="selectCategory(item)"> |
... | ... | @@ -78,11 +78,13 @@ |
78 | 78 |
<img :src="erroricon" alt=""> |
79 | 79 |
<span>등록시 사용유무는 변경 하실 수 없습니다.</span> |
80 | 80 |
</div> |
81 |
- <div class="invalid-feedback border" v-if="selectedCategory.useAt === 'Y' && newInsertCheck"> |
|
81 |
+ <div class="invalid-feedback border" |
|
82 |
+ v-if="selectedCategory.useAt === 'Y' && newInsertCheck"> |
|
82 | 83 |
<img :src="erroricon" alt=""> |
83 | 84 |
<span>삭제버튼을 누를 시 사용여부가 변경됩니다.</span> |
84 | 85 |
</div> |
85 |
- <div class="invalid-feedback border" v-if="selectedCategory.useAt === 'N' && newInsertCheck"> |
|
86 |
+ <div class="invalid-feedback border" |
|
87 |
+ v-if="selectedCategory.useAt === 'N' && newInsertCheck"> |
|
86 | 88 |
<img :src="erroricon" alt=""> |
87 | 89 |
<span>복구버튼을 누를 시 사용여부가 변경됩니다.</span> |
88 | 90 |
</div> |
... | ... | @@ -244,12 +246,14 @@ |
244 | 246 |
if (confirm("카테고리 등록을 하시겠습니까?")) { |
245 | 247 |
try { |
246 | 248 |
const response = await saveCategory(this.selectedCategory); |
247 |
- if (response.status === 200) { |
|
249 |
+ if (response.data.result) { // 성공 여부 체크 |
|
248 | 250 |
alert("등록되었습니다."); |
249 | 251 |
window.location.reload(); |
250 | 252 |
} |
251 | 253 |
} catch (error) { |
252 |
- alert("등록이 실패하였습니다."); |
|
254 |
+ // HTTP 오류가 발생한 경우 |
|
255 |
+ const errorMessage = error.response?.data?.message || "등록이 실패하였습니다."; |
|
256 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
253 | 257 |
this.searchCategories(); |
254 | 258 |
} |
255 | 259 |
} |
... | ... | @@ -265,7 +269,9 @@ |
265 | 269 |
this.searchCategories(); |
266 | 270 |
} |
267 | 271 |
} catch (error) { |
268 |
- alert("수정이 실패하였습니다."); |
|
272 |
+ // HTTP 오류가 발생한 경우 |
|
273 |
+ const errorMessage = error.response?.data?.message || "수정이 실패하였습니다."; |
|
274 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
269 | 275 |
this.searchCategories(); |
270 | 276 |
} |
271 | 277 |
} |
... | ... | @@ -278,7 +284,9 @@ |
278 | 284 |
this.searchCategories(); |
279 | 285 |
} |
280 | 286 |
} catch (error) { |
281 |
- alert("수정이 실패하였습니다."); |
|
287 |
+ // HTTP 오류가 발생한 경우 |
|
288 |
+ const errorMessage = error.response?.data?.message || "수정이이 실패하였습니다."; |
|
289 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
282 | 290 |
this.searchCategories(); |
283 | 291 |
} |
284 | 292 |
} |
--- client/views/pages/member/MemberManagement.vue
+++ client/views/pages/member/MemberManagement.vue
... | ... | @@ -249,20 +249,32 @@ |
249 | 249 |
}, |
250 | 250 |
// 등록 및 수정 |
251 | 251 |
async insertByUpdateUser() { |
252 |
- if (!this.isValidationUser()) { |
|
252 |
+ if (!this.newInsertCheck) { |
|
253 | 253 |
if (this.userId == null || this.userId == '') { |
254 | 254 |
this.updateUser(); |
255 | 255 |
if (confirm("회원가입을 하시겠습니까?")) { |
256 |
- try { |
|
257 |
- const response = await join(this.joinDTO); |
|
258 |
- if (response.status === 200) { |
|
259 |
- alert("회원가입되었습니다."); |
|
260 |
- window.location.reload(); |
|
256 |
+ if (this.$isEmpty(this.joinDTO.loginId)) { |
|
257 |
+ alert("아이디를 확인해주세요.") |
|
258 |
+ } else if (this.$isEmpty(this.password) && this.$isEmpty(this.passwordCheck)) { |
|
259 |
+ alert("비밀번호를 확인해주세요.") |
|
260 |
+ } else if (this.password != this.passwordCheck) { |
|
261 |
+ alert("비밀번호가 일치하지 않습니다.") |
|
262 |
+ } else if (this.$isEmpty(this.joinDTO.userNm)) { |
|
263 |
+ alert("이름을 확인해주세요.") |
|
264 |
+ } else { |
|
265 |
+ try { |
|
266 |
+ const response = await join(this.joinDTO); |
|
267 |
+ if (response.status === 200) { |
|
268 |
+ alert("회원가입되었습니다."); |
|
269 |
+ window.location.reload(); |
|
261 | 270 |
|
271 |
+ } |
|
272 |
+ } catch (error) { |
|
273 |
+ // HTTP 오류가 발생한 경우 |
|
274 |
+ const errorMessage = error.response?.data?.message || "회원가입이 실패하였습니다."; |
|
275 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
276 |
+ this.searchUsers(); |
|
262 | 277 |
} |
263 |
- } catch (error) { |
|
264 |
- alert("회원가입이 실패하였습니다."); |
|
265 |
- this.searchUsers(); |
|
266 | 278 |
} |
267 | 279 |
} |
268 | 280 |
} else { |
... | ... | @@ -278,7 +290,9 @@ |
278 | 290 |
this.searchUsers(); |
279 | 291 |
} |
280 | 292 |
} catch (error) { |
281 |
- alert("수정이 실패하였습니다."); |
|
293 |
+ // HTTP 오류가 발생한 경우 |
|
294 |
+ const errorMessage = error.response?.data?.message || "수정이 실패하였습니다."; |
|
295 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
282 | 296 |
this.searchUsers(); |
283 | 297 |
} |
284 | 298 |
} |
... | ... | @@ -292,7 +306,9 @@ |
292 | 306 |
this.searchUsers(); |
293 | 307 |
} |
294 | 308 |
} catch (error) { |
295 |
- alert("수정이 실패하였습니다."); |
|
309 |
+ // HTTP 오류가 발생한 경우 |
|
310 |
+ const errorMessage = error.response?.data?.message || "수정이 실패하였습니다."; |
|
311 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
296 | 312 |
this.searchUsers(); |
297 | 313 |
} |
298 | 314 |
} |
... | ... | @@ -302,14 +318,7 @@ |
302 | 318 |
alert("필수 항목 값을 입력해주세요"); |
303 | 319 |
} |
304 | 320 |
}, |
305 |
- //사용자 벨류데이션 체크 |
|
306 |
- isValidationUser() { |
|
307 |
- if (this.newInsertCheck) { |
|
308 |
- return this.selectedUser.userNm == null || this.selectedUser.userNm == '' || this.loginId == null || this.loginId == ''; |
|
309 |
- } else { |
|
310 |
- return this.selectedUser.userNm == null || this.selectedUser.userNm == '' || this.loginId == null || this.loginId == '' || this.password == null || this.password == ''; |
|
311 |
- } |
|
312 |
- }, |
|
321 |
+ |
|
313 | 322 |
validatePassword() { |
314 | 323 |
// 빈 문자열이나 null 체크 |
315 | 324 |
if (!this.password) { |
... | ... | @@ -367,7 +376,7 @@ |
367 | 376 |
this.copySelectedCategory = 'N' |
368 | 377 |
const response = await updateUsers(this.userId, this.selectedUser); |
369 | 378 |
if (response.status === 200) { |
370 |
- alert("탈퇴되었습니다.."); |
|
379 |
+ alert("탈퇴되었습니다."); |
|
371 | 380 |
this.copySelectedUser.useAt = 'N'; |
372 | 381 |
this.searchUsers(); |
373 | 382 |
} |
... | ... | @@ -384,7 +393,7 @@ |
384 | 393 |
this.copySelectedCategory = 'Y' |
385 | 394 |
const response = await updateUsers(this.userId, this.selectedUser); |
386 | 395 |
if (response.status === 200) { |
387 |
- alert("복구되었습니다.."); |
|
396 |
+ alert("복구되었습니다."); |
|
388 | 397 |
this.copySelectedUser.useAt = 'Y'; |
389 | 398 |
this.searchUsers(); |
390 | 399 |
} |
... | ... | @@ -405,13 +414,14 @@ |
405 | 414 |
try { |
406 | 415 |
const response = await updatePassword(this.userId, this.passwordResetAt); |
407 | 416 |
if (response.status === 200) { |
408 |
- alert("초기화화되었습니다.."); |
|
417 |
+ alert("초기화되었습니다."); |
|
409 | 418 |
this.searchUsers(); |
410 | 419 |
} |
411 | 420 |
} catch (error) { |
412 |
- alert("초기화가 실패하였습니다."); |
|
421 |
+ // HTTP 오류가 발생한 경우 |
|
422 |
+ const errorMessage = error.response?.data?.message || "비밀번호 초기화에 실패하였습니다."; |
|
423 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
413 | 424 |
this.searchUsers(); |
414 |
- |
|
415 | 425 |
} |
416 | 426 |
} |
417 | 427 |
} |
--- client/views/pages/user/MyInfo.vue
+++ client/views/pages/user/MyInfo.vue
... | ... | @@ -22,9 +22,7 @@ |
22 | 22 |
<dd> |
23 | 23 |
<label for="name" class="require">이름</label> |
24 | 24 |
<input type="text" id="name" v-model="userInfo.userNm"> |
25 |
- |
|
26 | 25 |
</dd> |
27 |
- |
|
28 | 26 |
</dl> |
29 | 27 |
</form> |
30 | 28 |
<h3>비밀번호 변경</h3> |
... | ... | @@ -145,67 +143,90 @@ |
145 | 143 |
}, |
146 | 144 |
async fnUpdateUser() { |
147 | 145 |
if (this.isValidationUser()) { |
148 |
- if (this.isValidationPasswdord()) { |
|
149 |
- alert("수정 할 내용이 없습니다."); |
|
146 |
+ if (this.$isEmpty(this.userPassword.oldPassword)) { |
|
147 |
+ alert("비밀번호를 확인해주세요.") |
|
148 |
+ } else if (this.$isEmpty(this.userPassword.newPassword)) { |
|
149 |
+ alert("새 비밀번호를 확인해주세요.") |
|
150 |
+ } else if (this.userPassword.newPassword != this.newPasswordCheck) { |
|
151 |
+ alert("새 비밀번호를 확인해주세요.") |
|
150 | 152 |
} else { |
151 |
- if (confirm("비밀번호 변경을 하시겠습니까?")) { |
|
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 |
- } |
|
153 |
+ try { |
|
154 |
+ const response = await updatePassword(this.$store.state.userId, this.userPassword); |
|
155 |
+ if (response.status === 200) { |
|
156 |
+ this.resetForm(); |
|
157 |
+ alert("비밀번호가 변경되었습니다."); |
|
158 |
+ window.location.reload(); // 페이지 새로 고침 |
|
164 | 159 |
} |
160 |
+ } catch (error) { |
|
161 |
+ // HTTP 오류가 발생한 경우 |
|
162 |
+ const errorMessage = error.response?.data?.message || "비밀번호 변경이 실패하였습니다."; |
|
163 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
164 |
+ window.location.reload(); // 페이지 새로 고침 |
|
165 | 165 |
} |
166 | 166 |
} |
167 | 167 |
} else { |
168 | 168 |
if (this.$store.state.userNm !== this.userInfo.userNm) { |
169 | 169 |
if (this.isValidationPasswdord()) { |
170 |
- if (confirm("회원정보를 변경을 하시겠습니까?")) { |
|
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("회원정보가 변경되었습니다."); |
|
170 |
+ if (confirm("회원정보를 변경을 하시겠습니까?\n(이름은 2자 이상 50자 이하여야 합니다. 특수문자 제외)")) { |
|
171 |
+ if ( |
|
172 |
+ this.userInfo.userNm && |
|
173 |
+ this.userInfo.userNm.length >= 2 && |
|
174 |
+ this.userInfo.userNm.length <= 50 && |
|
175 |
+ /^[\u3131-\u3163\uAC00-\uD7A3a-zA-Z0-9]*$/.test(this.userInfo.userNm) // 특수문자 제외 |
|
176 |
+ ) { |
|
177 |
+ try { |
|
178 |
+ const response = await updateUsers(this.$store.state.userId, this.userInfo); |
|
179 |
+ if (response.status === 200) { |
|
180 |
+ this.$store.commit("setUserNm", this.userInfo.userNm); |
|
181 |
+ this.resetForm(); |
|
182 |
+ alert("회원정보가 변경되었습니다."); |
|
183 |
+ window.location.reload(); // 페이지 새로 고침 |
|
184 |
+ } |
|
185 |
+ } catch (error) { |
|
186 |
+ // HTTP 오류가 발생한 경우 |
|
187 |
+ const errorMessage = error.response?.data?.message || "회원정보 변경이 실패하였습니다."; |
|
188 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
177 | 189 |
window.location.reload(); // 페이지 새로 고침 |
178 | 190 |
} |
179 |
- } catch (error) { |
|
180 |
- if (error.response && error.response.status === 401) { |
|
181 |
- alert("회원정보 변경이 실패하였습니다."); |
|
182 |
- window.location.reload(); // 페이지 새로 고침 |
|
183 |
- } |
|
191 |
+ } else { |
|
192 |
+ alert("이름은 2자 이상 50자 이하여야 합니다. 특수문자 제외"); |
|
184 | 193 |
} |
185 | 194 |
} |
186 | 195 |
} else { |
187 | 196 |
if (confirm("회원과 비밀번호를 변경하시겠습니까?")) { |
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("회원 및 비밀번호 변경이 실패하였습니다."); |
|
197 |
+ if (this.$isEmpty(this.userPassword.oldPassword)) { |
|
198 |
+ alert("비밀번호를 확인해주세요.") |
|
199 |
+ } else if (this.$isEmpty(this.userPassword.newPassword)) { |
|
200 |
+ alert("새 비밀번호를 확인해주세요.") |
|
201 |
+ } else if (this.userPassword.newPassword != this.newPasswordCheck) { |
|
202 |
+ alert("새 비밀번호를 확인해주세요.") |
|
203 |
+ } else { |
|
204 |
+ try { |
|
205 |
+ const res = await updateUsers(this.$store.state.userId, this.userInfo); |
|
206 |
+ const response = await updatePassword(this.$store.state.userId, this.userPassword); |
|
207 |
+ if (res.status === 200 && response.status === 200) { |
|
208 |
+ this.resetForm(); |
|
209 |
+ alert("회원과 비밀번호를 변경되었습니다."); |
|
210 |
+ window.location.reload(); // 페이지 새로 고침 |
|
211 |
+ } |
|
212 |
+ } catch (error) { |
|
213 |
+ // HTTP 오류가 발생한 경우 |
|
214 |
+ const errorMessage = error.response?.data?.message || "비밀번호 변경이 실패하였습니다."; |
|
215 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
199 | 216 |
window.location.reload(); // 페이지 새로 고침 |
200 | 217 |
} |
201 | 218 |
} |
202 | 219 |
} |
203 | 220 |
} |
204 | 221 |
} else { |
205 |
- if (this.isValidationPasswdord()) { |
|
206 |
- alert("수정 할 내용이 없습니다."); |
|
207 |
- } else { |
|
208 |
- if (confirm("비밀번호 변경을 하시겠습니까?")) { |
|
222 |
+ if (confirm("비밀번호 변경을 하시겠습니까?")) { |
|
223 |
+ if (this.$isEmpty(this.userPassword.oldPassword)) { |
|
224 |
+ alert("비밀번호를 확인해주세요.") |
|
225 |
+ } else if (this.$isEmpty(this.userPassword.newPassword)) { |
|
226 |
+ alert("새 비밀번호를 확인해주세요.") |
|
227 |
+ } else if (this.userPassword.newPassword != this.newPasswordCheck) { |
|
228 |
+ alert("새 비밀번호를 확인해주세요.") |
|
229 |
+ } else { |
|
209 | 230 |
try { |
210 | 231 |
const response = await updatePassword(this.$store.state.userId, this.userPassword); |
211 | 232 |
if (response.status === 200) { |
... | ... | @@ -214,10 +235,10 @@ |
214 | 235 |
window.location.reload(); // 페이지 새로 고침 |
215 | 236 |
} |
216 | 237 |
} catch (error) { |
217 |
- if (error.response && error.response.status === 401) { |
|
218 |
- alert("비밀번호 변경이 실패하였습니다."); |
|
219 |
- window.location.reload(); // 페이지 새로 고침 |
|
220 |
- } |
|
238 |
+ // HTTP 오류가 발생한 경우 |
|
239 |
+ const errorMessage = error.response?.data?.message || "비밀번호 변경이 실패하였습니다."; |
|
240 |
+ alert(errorMessage); // 오류 메시지 표시 |
|
241 |
+ window.location.reload(); // 페이지 새로 고침 |
|
221 | 242 |
} |
222 | 243 |
} |
223 | 244 |
} |
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?