Skip to content

Commit

Permalink
๐Ÿž BugFix(#79): auth ์ฟผ๋ฆฌ ํ‚ค ์ˆ˜์ •, Ranking ์ปดํฌ๋„ŒํŠธ์— createdAt ํ•„๋“œ ์ถ”๊ฐ€
Browse files Browse the repository at this point in the history
  • Loading branch information
bluetree7878 committed Jan 3, 2025
1 parent 0cad8a2 commit 18f35e1
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/features/auth/apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const authApis = {
const response = await api.get('/auth/verify');
return response.data;
},

logout: async (): Promise<void> => {
await api.post('/auth/logout');
},
Expand Down
12 changes: 7 additions & 5 deletions src/features/auth/queries.ts
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
import { useMutation, useQuery } from '@tanstack/react-query';
import { useQuery, useMutation } from '@tanstack/react-query';
import authApis from '@features/auth/apis';

const authKeys = {
verify: ['auth', 'verify'] as const,
logout: ['auth', 'logout'] as const,
all: ['auth'] as const,
verify: () => [...authKeys.all, 'verify'] as const,
logout: () => [...authKeys.all, 'logout'] as const,
};

export const authQuery = {
verify: () => {
return useQuery({
queryKey: authKeys.verify,
queryKey: authKeys.verify(),
queryFn: authApis.verify,
staleTime: 0,
gcTime: 0,
retry: false,
});
},

logout: () => {
return useMutation({
mutationKey: authKeys.logout,
mutationKey: authKeys.logout(),
mutationFn: authApis.logout,
});
},
Expand Down
31 changes: 25 additions & 6 deletions src/pages/ranking/Ranking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,30 @@ export default function Ranking() {
const [selectedOption, setSelectedOption] =
useState<keyof typeof RANKING_OPTIONS>('ํฌ์ธํŠธ ๋ณด์œ ์ˆœ');
const dummyUsers = [
{ id: 2, name: 'gwgw2', level: 4, point: 200 },
{ id: 3, name: 'gwgwgw3', level: 2, point: 5000 },
{ id: 4, name: 'gwgwgwgw4', level: 3, point: 160 },
{ id: 5, name: 'gwgwgwgwgw5', level: 10, point: 190 },
{ id: 6, name: 'gwgwgwgwgwgw6', level: 12, point: 230 },
{ id: 7, name: 'gwgwgwgwgwgwgw7', level: 1, point: 3000 },
{ id: 2, name: 'gwgw2', level: 4, point: 200, createdAt: '2021-10-01' },
{ id: 3, name: 'gwgwgw3', level: 2, point: 5000, createdAt: '2021-10-02' },
{ id: 4, name: 'gwgwgwgw4', level: 3, point: 160, createdAt: '2021-10-03' },
{
id: 5,
name: 'gwgwgwgwgw5',
level: 10,
point: 190,
createdAt: '2021-10-04',
},
{
id: 6,
name: 'gwgwgwgwgwgw6',
level: 12,
point: 230,
createdAt: '2021-10-05',
},
{
id: 7,
name: 'gwgwgwgwgwgwgw7',
level: 1,
point: 3000,
createdAt: '2021-10-06',
},
];

const myRank = {
Expand All @@ -26,6 +44,7 @@ export default function Ranking() {
level: 10,
point: 190,
rank: 4,
createdAt: '2021-10-04',
};

return (
Expand Down
1 change: 1 addition & 0 deletions src/store/useUserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import type { User } from '@features/user/types';
interface State {
user: User | null;
}

interface Actions {
setUser: (user: User) => void;
clearUser: () => void;
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.app.tsbuildinfo
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"root":["./src/app.tsx","./src/modalportal.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/axios/instance.ts","./src/axios/interceptor.ts","./src/axios/statuscode.ts","./src/common/layout/cokologo.tsx","./src/common/layout/header.tsx","./src/common/layout/menubar.tsx","./src/common/layout/modal.tsx","./src/common/layout/style.ts","./src/common/ui/headeritem.tsx","./src/common/ui/menuitem.tsx","./src/common/ui/style.ts","./src/features/auth/apis.ts","./src/features/auth/queries.ts","./src/features/auth/service/handlelogin.ts","./src/features/auth/service/handlelogout.ts","./src/features/auth/ui/login.tsx","./src/features/auth/ui/loginprompt.tsx","./src/features/auth/ui/styles.ts","./src/features/learn/apis.ts","./src/features/learn/constants.ts","./src/features/learn/queries.ts","./src/features/learn/types.ts","./src/features/learn/service/getpartgridposition.ts","./src/features/learn/ui/keycapadventureintro.tsx","./src/features/learn/ui/navigationcontrol.tsx","./src/features/learn/ui/sectionnavigatecontainer.tsx","./src/features/learn/ui/selectsection.tsx","./src/features/learn/ui/styles.ts","./src/features/progress/style.ts","./src/features/progress/ui/progressbar.tsx","./src/features/quest/types.ts","./src/features/quest/ui/dailyquest.tsx","./src/features/quest/ui/mainquest.tsx","./src/features/quest/ui/questsection.tsx","./src/features/quest/ui/styles.ts","./src/features/quiz/apis.ts","./src/features/quiz/constants.ts","./src/features/quiz/queries.ts","./src/features/quiz/types.ts","./src/features/quiz/service/hooks.ts","./src/features/quiz/service/quizutils.ts","./src/features/quiz/ui/combination.tsx","./src/features/quiz/ui/multiplechoice.tsx","./src/features/quiz/ui/oxselector.tsx","./src/features/quiz/ui/partnavcontainer.tsx","./src/features/quiz/ui/question.tsx","./src/features/quiz/ui/quizsection.tsx","./src/features/quiz/ui/result.tsx","./src/features/quiz/ui/shortanswer.tsx","./src/features/quiz/ui/textblock.tsx","./src/features/quiz/ui/styles.ts","./src/features/ranking/constant.ts","./src/features/ranking/ui/myrank.tsx","./src/features/ranking/ui/rankingcontainer.tsx","./src/features/ranking/ui/sortdropdown.tsx","./src/features/ranking/ui/styles.ts","./src/features/store/types.ts","./src/features/store/ui/cartlist.tsx","./src/features/store/ui/itemcontainer.tsx","./src/features/store/ui/storeitem.tsx","./src/features/store/ui/styles.ts","./src/features/user/apis.ts","./src/features/user/constants.ts","./src/features/user/queries.ts","./src/features/user/types.ts","./src/features/user/service/authutils.ts","./src/features/user/ui/badgecontainer.tsx","./src/features/user/ui/mycharacter.tsx","./src/features/user/ui/partclear.tsx","./src/features/user/ui/profileimage.tsx","./src/features/user/ui/totalresults.tsx","./src/features/user/ui/styles.ts","./src/hooks/usebeforeunload.ts","./src/hooks/usefunnel.tsx","./src/hooks/usemodal.ts","./src/hooks/useoutsideclick.ts","./src/hooks/usepopover.ts","./src/hooks/usepreloadimages.ts","./src/hooks/usescrollvisibility.ts","./src/pages/learn/learn.tsx","./src/pages/learn/style.ts","./src/pages/profile/profile.tsx","./src/pages/profile/styles.ts","./src/pages/quest/quest.tsx","./src/pages/quest/styles.ts","./src/pages/quiz/quiz.tsx","./src/pages/quiz/styles.ts","./src/pages/ranking/ranking.tsx","./src/pages/ranking/styles.ts","./src/pages/store/store.tsx","./src/pages/store/styles.ts","./src/route/router.tsx","./src/store/useclientquizstore.ts","./src/store/usedndstore.ts","./src/store/useuserstore.ts","./src/style/globalstyle.ts","./src/style/layout.ts","./src/style/media.ts","./src/style/style.ts","./src/types/layout.ts","./src/utils/compact.ts","./src/utils/componentmap.tsx","./src/utils/getimageurl.ts","./src/utils/handlepage.ts","./src/utils/isequalarray.ts"],"version":"5.6.2"}
{"root":["./src/app.tsx","./src/modalportal.tsx","./src/main.tsx","./src/vite-env.d.ts","./src/axios/instance.ts","./src/axios/interceptor.ts","./src/axios/statuscode.ts","./src/common/layout/cokologo.tsx","./src/common/layout/header.tsx","./src/common/layout/menubar.tsx","./src/common/layout/modal.tsx","./src/common/layout/style.ts","./src/common/ui/headeritem.tsx","./src/common/ui/menuitem.tsx","./src/common/ui/style.ts","./src/features/auth/apis.ts","./src/features/auth/queries.ts","./src/features/auth/service/handlelogin.ts","./src/features/auth/service/handlelogout.ts","./src/features/auth/ui/login.tsx","./src/features/auth/ui/loginprompt.tsx","./src/features/auth/ui/styles.ts","./src/features/learn/apis.ts","./src/features/learn/constants.ts","./src/features/learn/queries.ts","./src/features/learn/types.ts","./src/features/learn/service/getpartgridposition.ts","./src/features/learn/ui/keycapadventureintro.tsx","./src/features/learn/ui/navigationcontrol.tsx","./src/features/learn/ui/sectionnavigatecontainer.tsx","./src/features/learn/ui/selectsection.tsx","./src/features/learn/ui/styles.ts","./src/features/progress/style.ts","./src/features/progress/ui/progressbar.tsx","./src/features/quest/types.ts","./src/features/quest/ui/dailyquest.tsx","./src/features/quest/ui/mainquest.tsx","./src/features/quest/ui/questsection.tsx","./src/features/quest/ui/styles.ts","./src/features/quiz/apis.ts","./src/features/quiz/constants.ts","./src/features/quiz/queries.ts","./src/features/quiz/types.ts","./src/features/quiz/service/hooks.ts","./src/features/quiz/service/quizutils.ts","./src/features/quiz/ui/combination.tsx","./src/features/quiz/ui/multiplechoice.tsx","./src/features/quiz/ui/oxselector.tsx","./src/features/quiz/ui/partnavcontainer.tsx","./src/features/quiz/ui/question.tsx","./src/features/quiz/ui/quizsection.tsx","./src/features/quiz/ui/result.tsx","./src/features/quiz/ui/shortanswer.tsx","./src/features/quiz/ui/textblock.tsx","./src/features/quiz/ui/styles.ts","./src/features/ranking/constant.ts","./src/features/ranking/ui/myrank.tsx","./src/features/ranking/ui/rankingcontainer.tsx","./src/features/ranking/ui/sortdropdown.tsx","./src/features/ranking/ui/styles.ts","./src/features/store/types.ts","./src/features/store/ui/cartlist.tsx","./src/features/store/ui/itemcontainer.tsx","./src/features/store/ui/storeitem.tsx","./src/features/store/ui/styles.ts","./src/features/user/apis.ts","./src/features/user/constants.ts","./src/features/user/queries.ts","./src/features/user/types.ts","./src/features/user/service/authutils.ts","./src/features/user/ui/badgecontainer.tsx","./src/features/user/ui/mycharacter.tsx","./src/features/user/ui/partclear.tsx","./src/features/user/ui/profileimage.tsx","./src/features/user/ui/totalresults.tsx","./src/features/user/ui/styles.ts","./src/hooks/usebeforeunload.ts","./src/hooks/usefunnel.tsx","./src/hooks/usemodal.ts","./src/hooks/useoutsideclick.ts","./src/hooks/usepopover.ts","./src/hooks/usepreloadimages.ts","./src/hooks/usescrollvisibility.ts","./src/pages/learn/learn.tsx","./src/pages/learn/style.ts","./src/pages/profile/profile.tsx","./src/pages/profile/styles.ts","./src/pages/quest/quest.tsx","./src/pages/quest/styles.ts","./src/pages/quiz/quiz.tsx","./src/pages/quiz/styles.ts","./src/pages/ranking/ranking.tsx","./src/pages/ranking/styles.ts","./src/pages/store/store.tsx","./src/pages/store/styles.ts","./src/route/router.tsx","./src/store/useclientquizstore.ts","./src/store/usedndstore.ts","./src/store/useuserstore.ts","./src/style/globalstyle.ts","./src/style/layout.ts","./src/style/media.ts","./src/style/style.ts","./src/types/layout.ts","./src/utils/compact.ts","./src/utils/componentmap.tsx","./src/utils/formatdate.ts","./src/utils/getimageurl.ts","./src/utils/handlepage.ts","./src/utils/isequalarray.ts"],"version":"5.6.2"}

0 comments on commit 18f35e1

Please sign in to comment.