Skip to content

Commit

Permalink
Merge pull request #962 from 42organization/GGFE-213-일반랭킹트로피메인
Browse files Browse the repository at this point in the history
[GGFE-213] 메인에서 일반랭커보여주는 버그 수정
  • Loading branch information
parksangmin1543 authored Aug 28, 2023
2 parents 4fff5e5 + 7e62282 commit c2b3147
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 8 deletions.
5 changes: 3 additions & 2 deletions components/rank/topRank/RankListMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ export default function RankListMain({ isMain, season }: RankListMainProps) {
const [page] = useState<number>(1);

const makePathRanker = useMemo(() => {
return `/pingpong/users/images?seasonId=${season}&mode=${Mode}`;
}, [season, Mode]);
return `rank/${Mode}`;
}, [season, Mode, isMain]);

useRankListMain({
makePathRanker,
setRanker: setRanker,
toggleMode: Mode,
page: page,
season: season,
isMain: isMain,
});

useEffect(() => {
Expand Down
6 changes: 4 additions & 2 deletions hooks/rank/useRankListMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ interface useRankListProps {
season: number | undefined;
setRanker: Dispatch<SetStateAction<userImages[]>>;
page: number;
isMain: boolean;
}

const useRankListMain = ({
Expand All @@ -16,6 +17,7 @@ const useRankListMain = ({
season,
setRanker,
page,
isMain,
}: useRankListProps): void => {
/* const getRankerDataHandler = useAxiosGet<any>({
url: makePathRanker,
Expand All @@ -30,7 +32,7 @@ const useRankListMain = ({
type: 'setError',
}); */
const getRankerDataHandler = useMockAxiosGet<any>({
url: 'rank/user',
url: makePathRanker,
setState: (data) => {
[data.rankList[0], data.rankList[1]] = [
data.rankList[1],
Expand All @@ -44,7 +46,7 @@ const useRankListMain = ({

useEffect(() => {
getRankerDataHandler();
}, [page, season, toggleMode]);
}, [page, season, toggleMode, isMain]);
};

export default useRankListMain;
34 changes: 34 additions & 0 deletions pages/api/pingpong/rank/NORMAL.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { RankMain, userImages } from 'types/rankTypes';
import type { NextApiRequest, NextApiResponse } from 'next';

export default function handler(
req: NextApiRequest,
res: NextApiResponse<RankMain>
) {
const userImages: userImages[] = [
{
intraId: 'jeyoonnormal',
userImageUri: '/image/fallBackSrc.jpeg',
tierImageUri: '/image/fallBackSrc.jpeg',
edge: 'COLOR2',
},
{
intraId: 'hyobicho',
userImageUri: '/image/fallBackSrc.jpeg',
tierImageUri: '/image/fallBackSrc.jpeg',
edge: 'COLOR3',
},
{
intraId: 'hyungipa',
userImageUri: '/image/fallBackSrc.jpeg',
tierImageUri: '/image/fallBackSrc.jpeg',
edge: 'COLOR4',
},
];

const RankData: RankMain = {
rankList: userImages,
};

res.status(200).json(RankData);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ export default function handler(
) {
const userImages: userImages[] = [
{
intraId: '1',
intraId: 'jeyoon',
userImageUri: '/image/fallBackSrc.jpeg',
tierImageUri: '/image/fallBackSrc.jpeg',
edge: 'COLOR2',
},
{
intraId: '2',
intraId: 'hyobicho',
userImageUri: '/image/fallBackSrc.jpeg',
tierImageUri: '/image/fallBackSrc.jpeg',
edge: 'COLOR3',
},
{
intraId: '3',
intraId: 'hyungipa',
userImageUri: '/image/fallBackSrc.jpeg',
tierImageUri: '/image/fallBackSrc.jpeg',
edge: 'COLOR4',
Expand Down
2 changes: 1 addition & 1 deletion utils/recoil/colorMode.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ToggleMode } from 'types/rankTypes';
import { atom, selector } from 'recoil';
import { v1 } from 'uuid';
import { ColorMode } from 'types/colorModeTypes';
import { ToggleMode } from 'types/rankTypes';

export const colorModeState = atom<ColorMode>({
key: `ColorMode/${v1()}`,
Expand Down

0 comments on commit c2b3147

Please sign in to comment.