Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
phyuna0525 committed Nov 4, 2024
2 parents 1828fbb + db95104 commit 19af3e9
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 10 deletions.
1 change: 1 addition & 0 deletions src/components/calendar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ const Calendar = ({ type }: CalendarProp) => {
</Width>
{modal && selectedDate && (
<Modal
refetchStatus={ReSelfStudyData}
type={type}
title={`${selectedMonth}${selectedDay}${selectedWeekday}`}
subTitle="오늘의 자습감독 선생님"
Expand Down
28 changes: 18 additions & 10 deletions src/components/modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { SelectTeacher, PostTeacher } from '@/apis/self-study';
import closeIcon from '@/assets/svg/close.svg';
import plusIcon from '@/assets/svg/plus.svg';
import { AddSchedule, DaySchedule, DeleteSchedule } from '@/apis/schedule';
import { showToast } from '../toast';

interface ModalProp {
type?: 'check' | 'red' | 'selfStudy' | 'schedule';
Expand All @@ -16,19 +17,14 @@ interface ModalProp {
onConfirm: () => void;
initialDate?: string;
setState?: React.Dispatch<React.SetStateAction<boolean>>;
refetchStatus: () => void;
}

interface ChangeProps {
text: string;
name: string;
}

interface DataItem {
floor: number;
teacher: string;
date: string;
}

interface ScheduleData {
event_name: string;
date: string;
Expand All @@ -42,6 +38,7 @@ export const Modal = ({
type,
initialDate,
setState,
refetchStatus,
}: ModalProp) => {
const [secondData, setSecondData] = useState({ floor: 2, teacher: '' });
const [thirdData, setThirdData] = useState({ floor: 3, teacher: '' });
Expand Down Expand Up @@ -85,8 +82,11 @@ export const Modal = ({
{ id: id },
{
onSuccess: () => {
alert('삭제에 성공하셨습니다');
window.location.reload();
showToast({
type: 'success',
message: '삭제되었습니다',
});
refetchStatus();
},
},
);
Expand All @@ -106,7 +106,12 @@ export const Modal = ({

await postTeacherMutate(postData, {
onSuccess: () => {
showToast({
type: 'success',
message: '자습감독이 등록되었습니다',
});
setState(false);
refetchStatus();
},
});
} catch (error) {
Expand All @@ -119,8 +124,11 @@ export const Modal = ({
const handleModalConfirm = async () => {
await addScheduleMutate(addSchedule, {
onSuccess: () => {
location.reload();
alert('일정이 추가되었습니다');
showToast({
type: 'success',
message: '학사일정이 추가되었습니다',
});
refetchStatus();
},
onError: (error) => {
console.log(error);
Expand Down

0 comments on commit 19af3e9

Please sign in to comment.