Skip to content

Commit

Permalink
chore :: token 없으면 landing redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
dutexion committed Sep 26, 2024
1 parent f8e83d6 commit 3f01cde
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/pages/Team/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import { theme } from '@/style/theme';
import { TeamContainer } from '@/components/Team/TeamContainer';
import { SearchBar } from '@/components/common/SearchBar';
import { useNavigate } from 'react-router-dom';
import { useMemo, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import Skeleton from '@/components/common/Skeleton';
import { LimitBox } from '@/components/Layouts/LimitBox';
import { Text } from '@/components/Elements/Text';
import { VStack } from '@/components/Layouts/VStack';
import { Conditional } from '@/components/Headless/Conditional';
import { teamCheck } from '@/utils/apis/team';
import { Cookie } from '@/utils/cookie';

export const Team = () => {
const navigate = useNavigate();
Expand All @@ -20,6 +21,12 @@ export const Team = () => {
const { Wrapper: TeamListWrapper, Render, Loading, Empty } = Conditional();
const { data: teamList, isLoading } = teamCheck();

useEffect(() => {
const cookie = Cookie.get('accessToken');

if (cookie === null || cookie === undefined) navigate('/');
}, []);

const filteredTeamList = useMemo(() => {
if (!teamList) return [];
return teamList.filter((team) => team.team_name_ko.toLowerCase().includes(searchTerm.toLowerCase()));
Expand Down

0 comments on commit 3f01cde

Please sign in to comment.