diff --git a/src/api/classChange/index.ts b/src/api/classChange/index.ts index dac036f..fe847fb 100644 --- a/src/api/classChange/index.ts +++ b/src/api/classChange/index.ts @@ -27,7 +27,7 @@ export const AcceptClass = () => { try { await instance.patch(`/class-room/status`, { status: param.status, - ids: param.id, + id_list: param.id, }); } catch (error) { handleError(error); diff --git a/src/api/outList/index.ts b/src/api/outList/index.ts index ba9585b..e368065 100644 --- a/src/api/outList/index.ts +++ b/src/api/outList/index.ts @@ -65,7 +65,7 @@ export const OutAcceptApi = () => { const response = await instance.patch(`${param.type}/status`, { type: param.type, status: param.status, - ids: param.ids, + id_list: param.id_list, }); return response.data; } catch (error) { diff --git a/src/api/type.ts b/src/api/type.ts index 032f06c..ce11076 100644 --- a/src/api/type.ts +++ b/src/api/type.ts @@ -1,6 +1,6 @@ export interface applicationOK { user_id: string; - username: string; + user_name: string; start: string; id: string; end: string; @@ -13,7 +13,7 @@ export interface applicationOK { export interface earlyReturnHome { id: string; - username: string; + user_name: string; start_time: string; grade: number; class_num: number; @@ -24,7 +24,7 @@ export interface earlyReturnHome { export interface Accept { type: string; status: "OK" | "NO"; - ids: string[]; + id_list: string[]; } export interface ClassProp { @@ -35,7 +35,7 @@ export interface ClassProp { export interface ClubList { id: string; - username: string; + user_name: string; grade: number; class_num: number; num: number; @@ -63,7 +63,7 @@ export interface FloorClass { move: string; num: number; start_period: number; - username: string; + user_name: string; } export interface CountOutListType { @@ -76,14 +76,14 @@ export interface Type { grade: number; class_num: number; num: number; - name: string; + user_name: string; } export interface AfterStudent { id: string; grade: number; class_num: number; num: number; - name: string; + user_name: string; classroom_name: string; status: string; } @@ -102,5 +102,5 @@ export interface changeClass { num: number; move: string; user_id: string; - username: string; + user_name: string; } diff --git a/src/app/afterManage/page.tsx b/src/app/afterManage/page.tsx index 1bb3c05..bb5f5d9 100644 --- a/src/app/afterManage/page.tsx +++ b/src/app/afterManage/page.tsx @@ -137,7 +137,7 @@ const AfterManage = () => { key={index} id={item.id} state={item.status} - name={`${setStudentNum(item)} ${item.name}`} + name={`${setStudentNum(item)} ${item.user_name}`} class_name={item.classroom_name} /> ); @@ -150,7 +150,7 @@ const AfterManage = () => { ) : ( <> {getStudent?.map((item, index) => ( - + ))} )} diff --git a/src/app/classChange/page.tsx b/src/app/classChange/page.tsx index b5b85e8..08ca590 100644 --- a/src/app/classChange/page.tsx +++ b/src/app/classChange/page.tsx @@ -2,19 +2,17 @@ import { getFullToday } from "@/util/date"; import BackGround from "@/components/background"; import Dropdown from "@/components/dropdown"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import Button from "@/components/button"; import { useRouter } from "next/navigation"; import { getStudentString } from "@/util/util"; import Modal from "@/components/modal"; import { AcceptClass, AcceptClassChange } from "@/api/classChange"; -import { FloorClass } from "@/api/type"; import ChangeClass from "@/components/classChange"; import useAcceptListSelection from "@/hook/handleAcceptListClick"; const ClassChange = () => { const [selectedFloor, setSelectedFloor] = useState(5); - const [data, setData] = useState([]); const [accept, setAccept] = useState(false); const [refuse, setRefuse] = useState(false); const { selectedStudents, selectedStudentName, handleAcceptListClick } = @@ -41,16 +39,7 @@ const ClassChange = () => { } }; - useEffect(() => { - if (AccpetMutate) { - setData(AccpetMutate); - } - }, [AccpetMutate]); - - const nav = useRouter(); - const handleFloorChange = (selectedOption: number) => { - setData([]); setSelectedFloor(selectedOption); }; @@ -139,11 +128,11 @@ const ClassChange = () => { } >
- {data?.map((item, index) => ( + {AccpetMutate?.map((item, index) => ( handleAcceptListClick(item.user_id, item.username)} + onClick={() => handleAcceptListClick(item.id, item.user_name)} prevClass={item.move} nextClass={`${item.classroom_name}`} student={getStudentString(item)} diff --git a/src/app/outAccept/page.tsx b/src/app/outAccept/page.tsx index 36a2a0b..1ecd4d9 100644 --- a/src/app/outAccept/page.tsx +++ b/src/app/outAccept/page.tsx @@ -127,7 +127,7 @@ const OutAccept = () => { { type: reqOption, status: "NO", - ids: selectedStudents, + id_list: selectedStudents, }, { onSuccess: () => { @@ -155,7 +155,7 @@ const OutAccept = () => { { type: reqOption, status: "OK", - ids: selectedStudents, + id_list: selectedStudents, }, { onSuccess: () => { @@ -221,7 +221,7 @@ const OutAccept = () => { key={index} returnTime={`${item.start}~${item.end}`} name={getStudentString(item)} - onClick={() => handleAcceptListClick(item.id, item.username)} + onClick={() => handleAcceptListClick(item.id, item.user_name)} reason={item.reason} /> )) @@ -232,7 +232,7 @@ const OutAccept = () => { key={index} returnTime={`${item.start}~ `} name={getStudentString(item)} - onClick={() => handleAcceptListClick(item.id, item.username)} + onClick={() => handleAcceptListClick(item.id, item.user_name)} reason={item.reason} /> ))} diff --git a/src/app/outList/page.tsx b/src/app/outList/page.tsx index 4858e16..b5cbc64 100644 --- a/src/app/outList/page.tsx +++ b/src/app/outList/page.tsx @@ -93,7 +93,7 @@ const OutList = () => { {data?.map((item, index) => ( { - handleAcceptListClick(item.id, item.username); + handleAcceptListClick(item.id, item.user_name); }} id={item.id} type="application" diff --git a/src/components/input/auto.tsx b/src/components/input/auto.tsx index 357aafb..4592a18 100644 --- a/src/components/input/auto.tsx +++ b/src/components/input/auto.tsx @@ -57,7 +57,9 @@ const AutoInput: React.FC = ({ }, [GetStudentMutate]); useEffect(() => { - const students = data?.map((item) => `${setStudentNum(item)} ${item.name}`); + const students = data?.map( + (item) => `${setStudentNum(item)} ${item.user_name}` + ); setStudent(students); }, [data]); diff --git a/src/util/util.ts b/src/util/util.ts index 0f058f5..bc38245 100644 --- a/src/util/util.ts +++ b/src/util/util.ts @@ -10,7 +10,7 @@ interface Student { grade: number; class_num: number; num: number; - username: string; + user_name: string; } interface studentNum { @@ -23,10 +23,10 @@ export const getStudentString = ({ grade, class_num, num, - username, + user_name, }: Student) => { const change = num.toString().length === 1 ? `0${num}` : `${num}`; - return `${grade}${class_num}${change} ${username}`; + return `${grade}${class_num}${change} ${user_name}`; }; export const setStudentNum = ({ grade, class_num, num }: studentNum) => { @@ -53,6 +53,6 @@ export const ChangeOut = (type: "APPLICATION" | "EARLY_RETURN") => { }; enum a { - APPLICATION="외출", - EARLY_RETURN="조기귀가" -} \ No newline at end of file + APPLICATION = "외출", + EARLY_RETURN = "조기귀가", +}