diff --git a/src/hooks/query/useTeamQuery.ts b/src/hooks/query/useTeamQuery.ts index ea3df5a..ab9b5cc 100644 --- a/src/hooks/query/useTeamQuery.ts +++ b/src/hooks/query/useTeamQuery.ts @@ -16,14 +16,7 @@ import { import useToast from '@hooks/useToast'; import { useMemo } from 'react'; import useStore from '@stores/useStore'; -import type { - Team, - TeamCoworker, - TeamForm, - TeamListWithApproval, - TeamInfoForm, - TeamCoworkerForm, -} from '@/types/TeamType'; +import type { Team, TeamForm, TeamListWithApproval, TeamInfoForm, TeamCoworkerForm } from '@/types/TeamType'; import type { User } from '@/types/UserType'; // 전체 팀 목록 조회 @@ -87,16 +80,17 @@ export function useLeaveTeam() { export function useDeleteTeam() { const queryClient = useQueryClient(); const { toastSuccess, toastError } = useToast(); + const { userInfo } = useStore(); + const teamsQueryKey = generateTeamsQueryKey(userInfo.userId); const mutation = useMutation({ mutationFn: (teamId: Team['teamId']) => deleteTeam(teamId), onError: () => { toastError('팀 삭제를 실패했습니다. 다시 시도해 주세요.'); }, - onSuccess: (_, teamId) => { - const teamCoworkersQueryKey = generateTeamCoworkersQueryKey(teamId); + onSuccess: () => { toastSuccess('팀을 삭제하였습니다.'); - queryClient.invalidateQueries({ queryKey: teamCoworkersQueryKey }); + queryClient.invalidateQueries({ queryKey: teamsQueryKey }); }, }); diff --git a/src/layouts/page/SettingLayout.tsx b/src/layouts/page/SettingLayout.tsx index 464eb68..63f3d88 100644 --- a/src/layouts/page/SettingLayout.tsx +++ b/src/layouts/page/SettingLayout.tsx @@ -34,7 +34,7 @@ export default function SettingLayout() { -
+
{getTitle()} diff --git a/src/layouts/page/TeamSettingLayout.tsx b/src/layouts/page/TeamSettingLayout.tsx index df590ff..213f817 100644 --- a/src/layouts/page/TeamSettingLayout.tsx +++ b/src/layouts/page/TeamSettingLayout.tsx @@ -1,4 +1,4 @@ -import { Outlet, useNavigate } from 'react-router-dom'; +import { NavLink, Outlet, useNavigate } from 'react-router-dom'; import { useEffect } from 'react'; import Spinner from '@components/common/Spinner'; import { useReadTeams } from '@hooks/query/useTeamQuery'; @@ -15,17 +15,17 @@ export default function TeamSettingLayout() { if (isLoading) return ; return ( -
+
- - +
-
+
diff --git a/src/mocks/services/teamServiceHandler.ts b/src/mocks/services/teamServiceHandler.ts index 7b0c4f6..9fcb63f 100644 --- a/src/mocks/services/teamServiceHandler.ts +++ b/src/mocks/services/teamServiceHandler.ts @@ -160,7 +160,7 @@ const teamServiceHandler = [ const accessToken = request.headers.get('Authorization'); const { teamId } = params; - if (!accessToken) return new HttpResponse(null, { status: 403 }); + if (!accessToken) return new HttpResponse(null, { status: 401 }); const filteredTeams = TEAM_DUMMY.filter((team) => team.teamId !== Number(teamId)); TEAM_DUMMY.length = 0; @@ -196,6 +196,7 @@ const teamServiceHandler = [ const projectId = statusId ? STATUS_DUMMY.find((status) => status.statusId === statusId)?.projectId : undefined; return !(projectId && projectIdsToDelete.includes(projectId)); }); + TASK_FILE_DUMMY.length = 0; TASK_FILE_DUMMY.push(...filteredTaskFiles); @@ -205,6 +206,7 @@ const teamServiceHandler = [ const projectId = statusId ? STATUS_DUMMY.find((status) => status.statusId === statusId)?.projectId : undefined; return !(projectId && projectIdsToDelete.includes(projectId)); }); + TASK_USER_DUMMY.length = 0; TASK_USER_DUMMY.push(...filteredTaskUsers); diff --git a/src/pages/setting/TeamInvitedPage.tsx b/src/pages/setting/TeamInvitedPage.tsx index 82ebb27..032a64c 100644 --- a/src/pages/setting/TeamInvitedPage.tsx +++ b/src/pages/setting/TeamInvitedPage.tsx @@ -6,51 +6,59 @@ export default function InvitedTeamPage() { const { invitedTeamList, isLoading } = useReadTeams(); const { mutate: ApproveInvitation } = useApproveTeamInvitation(); const { mutate: RejectInvitation } = useRejectTeamInvitation(); + if (isLoading) return ; return ( <> -
+
{invitedTeamList && invitedTeamList.length > 0 ? ( -
    - {invitedTeamList.map((invite) => ( -
  • -
    -
    - team -

    {invite.teamName}

    -
    -
    - head -

    {invite.creator}

    +
    +
      + {invitedTeamList.map((invite) => ( +
    • +
      +
      + +

      {invite.teamName}

      +
      +
      + 팀장 +

      {invite.creator}

      +
      +
      + 소개 +

      {invite.content}

      +
      -
      - desc -

      {invite.content}

      + +
      + +
      -
      -
      - - -
      -
    • - ))} -
    +
  • + ))} +
+
) : ( -
+
현재 가입 대기중인 팀이 없습니다!
팀에 가입해 보세요 😄
diff --git a/src/pages/setting/TeamJoinedPage.tsx b/src/pages/setting/TeamJoinedPage.tsx index 3892b81..99a1017 100644 --- a/src/pages/setting/TeamJoinedPage.tsx +++ b/src/pages/setting/TeamJoinedPage.tsx @@ -15,24 +15,25 @@ export default function JoinedTeamPage() {
{joinedTeamList && joinedTeamList.length > 0 ? ( -
    +
      {joinedTeamList.map((team) => ( -
    • -
      -
      +
    • +
      +
      team

      {team.teamName}

      -
      +
      head

      {team.creator}

      -
      +
      desc

      {team.content}

      -
      + +
      {team.creatorId === userInfo.userId && (