diff --git a/src/apis/_type.ts b/src/apis/_type.ts index 3f4e1cf..1a16c9c 100644 --- a/src/apis/_type.ts +++ b/src/apis/_type.ts @@ -16,11 +16,11 @@ interface Store { } interface AbstractMember { - id: string; - name: string; - phone: string; - providerType: ProviderType; - storeList: Store[]; + id: string | null; + name: string | null; + phone: string | null; + providerType: ProviderType | null; + storeList: Store[] | null; } export type { StatusType, DayType, ProviderType, RoleType }; diff --git a/src/apis/history.ts b/src/apis/history.ts index 8305574..efcc9e6 100644 --- a/src/apis/history.ts +++ b/src/apis/history.ts @@ -19,8 +19,8 @@ interface History extends PostHistoryBody { relation: { position: string; member: { - name: string; - phone: string; + name: string | null; + phone: string | null; }; }; } diff --git a/src/pages/manage/attendance.tsx b/src/pages/manage/attendance.tsx index a357ec8..37be9b1 100644 --- a/src/pages/manage/attendance.tsx +++ b/src/pages/manage/attendance.tsx @@ -39,7 +39,7 @@ export default function Attendance() { const allButtonClick = () => { filteredList.forEach(history => { - if (history.status === "DISAPPROVED") { + if (history.status === "DISAPPROVED" && history.relation.member.id) { postHistoryStatusMutate({ memberId: history.relation.member.id, historyId: history.id, @@ -51,6 +51,7 @@ export default function Attendance() { const profileClick = (index: number) => { const history = filteredList[index]; + if (!history.relation.member.id) return; postHistoryStatusMutate({ memberId: history.relation.member.id, historyId: history.id, diff --git a/src/pages/mypage/authority.tsx b/src/pages/mypage/authority.tsx index 2733371..19286c4 100644 --- a/src/pages/mypage/authority.tsx +++ b/src/pages/mypage/authority.tsx @@ -19,6 +19,7 @@ export default function MyPageAuthorithy() { const addNewAdmin = () => { checkedEmployees.forEach(item => { + if (!item?.member.id) return; postRelationAdminMutate({ memberId: item?.member.id, body: { ...item, role: "MANAGER" }, diff --git a/src/screen/manage/AddWorkModal.tsx b/src/screen/manage/AddWorkModal.tsx index 20bd70d..0848fbf 100644 --- a/src/screen/manage/AddWorkModal.tsx +++ b/src/screen/manage/AddWorkModal.tsx @@ -35,7 +35,7 @@ export default function AddWorkModal() { useEffect(() => { const tempList = relationList?.map( - relationInfo => relationInfo.member.name, + relationInfo => relationInfo.member.name ?? "탈퇴한 회원", ); setMemberNameList(tempList ?? []); }, [relationList]); diff --git a/src/screen/manage/StaffInform.tsx b/src/screen/manage/StaffInform.tsx index 8dd0888..7a4160b 100644 --- a/src/screen/manage/StaffInform.tsx +++ b/src/screen/manage/StaffInform.tsx @@ -49,7 +49,7 @@ export default function StaffInform() { ))} diff --git a/src/screen/mypage/RelationSlider.tsx b/src/screen/mypage/RelationSlider.tsx index c88a820..a34cf5c 100644 --- a/src/screen/mypage/RelationSlider.tsx +++ b/src/screen/mypage/RelationSlider.tsx @@ -30,8 +30,9 @@ export default function RelationSlider({ focus={relation.member.id === currentMemberId} />
- {relation.member.name.slice(0, 5)} - {relation.member.name.length > 5 && "..."} + {relation.member.name === null + ? "탈퇴한 회원" + : `${relation.member.name?.slice(0, 5)}${relation.member.name && relation.member.name.length > 5 ? "..." : ""}`}
diff --git a/src/screen/mypage/authority/AdminAdd.tsx b/src/screen/mypage/authority/AdminAdd.tsx index 4d4e807..50a5f40 100644 --- a/src/screen/mypage/authority/AdminAdd.tsx +++ b/src/screen/mypage/authority/AdminAdd.tsx @@ -24,7 +24,9 @@ export default function AdminAdd({ }; return ( -
{relation.member.name}
+
+ {relation.member.name ?? "탈퇴한 회원"} +
{ + if (!relation.member.id) return; postRelationAdminMutate({ memberId: relation.member.id, body: { ...relation, role: "STAFF" },