Skip to content
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
8 changes: 3 additions & 5 deletions src/api/task/get-task-detail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ export const fetchTaskDetail = async (
}
);

if (!response) return notFound();
if (response.status === 404) notFound();

return response.json();
} catch (error) {
console.error(error);
throw error;
}
};

Expand All @@ -42,10 +42,8 @@ export const getTaskDetail = async (
`/groups/${groupId}/task-lists/${taskListId}/tasks/${taskId}`
);

if (!response) throw new Error("데이터를 불러오지 못했습니다.");

return response.data;
} catch (error) {
console.error(error);
throw error;
}
};
14 changes: 6 additions & 8 deletions src/app/[groupId]/tasklist/@task/_components/task-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,13 @@ const TaskDetail = () => {
router.push(`${pathName}?list=${taskListId}`);
};

const { data: taskDetailData, isPending } = useGetTaskDetail(
groupId,
taskListId,
taskId
);
const {
data: taskDetailData,
isPending,
isError,
} = useGetTaskDetail(groupId, taskListId, taskId);

if (taskId) {
if (!taskDetailData) notFound();
}
if (isError) notFound();

return (
<AnimatePresence mode="wait">
Expand Down