Skip to content

Commit

Permalink
๐Ÿ›fix: ์˜ค๋ฅ˜ ์ˆ˜์ •
Browse files Browse the repository at this point in the history
  • Loading branch information
heejung0413 committed Jul 30, 2024
1 parent 5db37c9 commit 29163f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 30 deletions.
6 changes: 1 addition & 5 deletions src/pages/RetroListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Pagination from '@/components/RetroList/Pagination';
import ProgressButton from '@/components/RetroList/ProgressButton';
import Search from '@/components/RetroList/Search';
import ViewButton from '@/components/RetroList/ViewButton';
import { useCustomToast } from '@/hooks/useCustomToast';
import * as S from '@/styles/RetroList/RetroListPage.style';

const formatDate = (isoDateString: string) => {
Expand All @@ -25,7 +24,6 @@ const formatDate = (isoDateString: string) => {

const RetroListPage = () => {
const [data, setData] = useState<GetRetrospectiveData['data']>({ totalCount: 0, nodes: [] });
const toast = useCustomToast();
const [page, setPage] = useState<number>(Math.ceil(data.totalCount / 10));
const [currentPage, setCurrentPage] = useState<number>(1);
const [bookmarkUpdate, setBookmarkUpdate] = useState<boolean>(false);
Expand Down Expand Up @@ -58,13 +56,11 @@ const RetroListPage = () => {

useEffect(() => {
const fetchRetrolist = async () => {
// console.log(query);
try {
const responseData = await queryGetRetrospective(query);
setData(responseData.data);
} catch (error) {
// console.error('ํšŒ๊ณ  ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๋„์ค‘ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์Šต๋‹ˆ๋‹ค:', error);
toast.error(error);
console.error(error);
}
};
fetchRetrolist();
Expand Down
27 changes: 2 additions & 25 deletions src/pages/SectionPage.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect, useState } from 'react';
import { useLocation, useNavigate } from 'react-router-dom';
import { useLocation } from 'react-router-dom';
// import { Flex } from '@chakra-ui/react';
import { RetrospectiveData } from '@/api/@types/Retrospectives';
import { sectionData } from '@/api/@types/Section';
import { TeamMembersData, TemplateNameData } from '@/api/@types/TeamController';
import { TemplateNameData } from '@/api/@types/TeamController';
import { UserData } from '@/api/@types/Users';
import { RetrospectiveService } from '@/api/services/Retrospectives';
import { SectionServices } from '@/api/services/Section';
Expand All @@ -27,21 +27,7 @@ const RetroTeamPage = () => {
const [template, setTemplate] = useState<TemplateNameData[]>();
const [rendering, setRendering] = useState<boolean>(false);
const [user, setUser] = useState<UserData>();
const [members, setMembers] = useState<TeamMembersData[]>([]);
const toast = useCustomToast();
const navigate = useNavigate();

const fetchTeamMembers = async () => {
try {
if (teamId) {
const data = await TeamControllerServices.TeamMemberGet({ teamId: teamId, retrospectiveId: retrospectiveId });
setMembers(data.data);
}
return;
} catch (e) {
toast.error(e);
}
};

const fetchRetrospective = async () => {
try {
Expand Down Expand Up @@ -86,19 +72,10 @@ const RetroTeamPage = () => {
fetchRetrospective();
fetchTemplate();
fetchUser();
fetchTeamMembers();
}, [retro?.description, rendering]);

if (!retro) return;
if (!user) return;
if (teamId && !members.some(value => value.userId === user.userId)) {
toast.error('ํšŒ๊ณ  ๋ณด๊ธฐ ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.');
navigate('/');
}
if (!teamId && retro.userId !== user.userId) {
toast.error('ํšŒ๊ณ  ๋ณด๊ธฐ ๊ถŒํ•œ์ด ์—†์Šต๋‹ˆ๋‹ค.');
navigate('/');
}

return (
<S.Container>
Expand Down

0 comments on commit 29163f8

Please sign in to comment.