Skip to content

Commit

Permalink
Merge pull request #106 from capstone-five-ai/develop
Browse files Browse the repository at this point in the history
v0.1.2
  • Loading branch information
AAminha authored Jun 3, 2024
2 parents 08a1221 + 6502457 commit 800aa87
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 2 additions & 0 deletions src/components/Navigation/TopNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ function TopNavigation() {

if (response) {
setIsAuthenticated(false);
localStorage.removeItem('accessToken');
localStorage.removeItem('refreshToken');
navigate('/login');
}
} catch (error) {
Expand Down
20 changes: 9 additions & 11 deletions src/pages/CategoryPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,20 @@ function CategoryPage() {
} = useGetCategoryList('SUMMARY');

useEffect(() => {
if (
!type &&
fetchedQuizCategoryList.data.length +
fetchedSummaryCategoryList.data.length !==
0
)
const quizLength = fetchedQuizCategoryList?.data?.length || 0;
const summaryLength = fetchedSummaryCategoryList?.data?.length || 0;

if (!type && quizLength + summaryLength !== 0)
redirect('/management/category?type=quiz');

if (type && type !== 'QUIZ' && type !== 'SUMMARY')
redirect('/management/category');
}, [type, fetchedQuizCategoryList.data, fetchedSummaryCategoryList.data]);
}, [type, fetchedQuizCategoryList, fetchedSummaryCategoryList]);

if (
!type &&
fetchedQuizCategoryList.data.length +
fetchedSummaryCategoryList.data.length ===
(fetchedQuizCategoryList?.data?.length || 0) +
(fetchedSummaryCategoryList?.data?.length || 0) ===
0
)
return <NoCategorySection />;
Expand All @@ -44,8 +42,8 @@ function CategoryPage() {
<CategorySection
refetchQuizCategoryList={refetchQuizCategoryList}
refetchSummaryCategoryList={refetchSummaryCategoryList}
quizCategories={fetchedQuizCategoryList.data}
summaryCategories={fetchedSummaryCategoryList.data}
quizCategories={fetchedQuizCategoryList?.data || []}
summaryCategories={fetchedSummaryCategoryList?.data || []}
/>
);
}
Expand Down

0 comments on commit 800aa87

Please sign in to comment.