Skip to content

Commit

Permalink
feat: 데모데이 투표 에러처리
Browse files Browse the repository at this point in the history
  • Loading branch information
ddhelop committed Jun 26, 2024
1 parent c5fee62 commit c861aaa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/components/PartLeaderVote/BackEndVote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,16 @@ export default function BackEndVote() {
const token = localStorage.getItem('token') || '';
try {
const response = await LeaderVoteAction(memberId, token);
const result = await response.json();
console.log(response, result);

if (response.ok) {
alert('투표가 완료되었습니다.');
router.push('/vote/back-end/result');
}
if (result.status === 400) {
alert(result.message);
}
} catch (error) {
console.error('투표 중 오류가 발생했습니다:', error);
}
Expand Down
4 changes: 4 additions & 0 deletions src/components/PartLeaderVote/FrontEndVote.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,15 @@ export default function FrontEndVote() {
const token = localStorage.getItem('token') || '';
try {
const response = await LeaderVoteAction(memberId, token);
const result = await response.json();

if (response.ok) {
alert('투표가 완료되었습니다.');
router.push('/vote/front-end/result');
}
if (result.status === 400) {
alert(result.message);
}
} catch (error) {
console.error('투표 중 오류가 발생했습니다:', error);
}
Expand Down

0 comments on commit c861aaa

Please sign in to comment.