Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

그룹 삭제 시 확인 알림창 구현 #104

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/containers/group/create/CreateGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export default function CreateGroup() {
address: formik.values.address,
businessNumber: formik.values.businessNumber,
email: formik.values.email,
imageUrl: "defaultGroup.png",
imageUrl: "groupDefault.png",
};
const response = await createGroup(requestCreateGroup);

Expand All @@ -114,6 +114,7 @@ export default function CreateGroup() {
} else {
alert("그룹 생성에 실패했습니다.");
}
window.location.href = "/group";
};

const requestCheckDuplicateGroupName = async () => {
Expand Down
4 changes: 4 additions & 0 deletions src/containers/group/detail/GroupDetail.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
transform: translate(-50%, -50%);
}

.left_bar {
min-width: 19rem;
}

.group_title {
font-size: 35px;
font-weight: 700;
Expand Down
2 changes: 1 addition & 1 deletion src/containers/group/detail/GroupDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default function GroupDetail() {
<>
{groupData ? (
<div className={styles.container}>
<div>
<div className={styles.left_bar}>
<h1 className={styles.group_title}>{groupData.name}</h1>
<Listbox
items={items}
Expand Down
2 changes: 1 addition & 1 deletion src/containers/group/detail/contents/AttendanceManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { useState, useEffect, useMemo } from "react";
import styles from "./AttendanceManage.module.css";
import { Pagination, Link, Button } from "@nextui-org/react";
import { Pagination, Button } from "@nextui-org/react";
import usePagination from "@/hooks/usePagination";
import {
AttendanceStatus,
Expand Down
11 changes: 9 additions & 2 deletions src/containers/group/detail/contents/GroupManage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,18 @@ export default function GroupManage(props: GroupManageProps) {
alert("그룹 정보가 수정되었습니다.");
};

const requestDeleteGroup = () => {
const response = deleteGroup(props.id);
const requestDeleteGroup = async () => {
if (!confirm("정말로 그룹을 삭제하시겠습니까?")) {
return;
}
const response = await deleteGroup(props.id);
if (!response) {
console.error("[Error] 그룹 정보 삭제 실패");
}
if (response.status === 200) {
alert("그룹이 삭제되었습니다.");
window.location.href = "/group";
}
};

return (
Expand Down
3 changes: 2 additions & 1 deletion src/services/group/group.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ export const deleteGroup = async (groupId: number) => {
"Authorization": `Bearer ${localStorage.getItem("accessToken")}`,
},
});
return response.status === 200;
return { status: 200 };
} catch (error) {
console.error(error);
return { status: 500 };
}
};

Expand Down
Loading