Skip to content

Commit 0184968

Browse files
authored
Merge pull request #360 from depromeet/revert-359-develop
Revert "배포용 pr"
2 parents 0046c39 + 0ed88d1 commit 0184968

File tree

9 files changed

+33
-35
lines changed

9 files changed

+33
-35
lines changed

next.config.js

-6
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
9;
21
/** @type {import('next').NextConfig} */
32
const nextConfig = {
43
experimental: {
@@ -12,11 +11,6 @@ const nextConfig = {
1211
hostname: 'kr.object.ncloudstorage.com',
1312
port: '',
1413
},
15-
{
16-
protocol: 'https',
17-
hostname: 'image.10mm.today',
18-
port: '',
19-
},
2014
],
2115
},
2216
};

src/apis/createQueryKeyFactory.ts

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const createQueryKeyFactory = <T extends Record<string, unknown>>(queryKey: string) => {
2+
return (params: T) => {
3+
return [queryKey, ...Object.values(params)];
4+
};
5+
};

src/apis/member.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import getQueryKey from '@/apis/getQueryKey';
21
import apiInstance from '@/apis/instance.api';
32
import { type MemberType } from '@/apis/schema/member';
43
import { type UploadBaseRequest, type UploadUrlBaseResponse } from '@/apis/schema/upload';
@@ -102,14 +101,14 @@ export const useUploadProfileImageComplete = (
102101
...option,
103102
onSuccess: (...res) => {
104103
option?.onSuccess && option.onSuccess(...res);
105-
return queryClient.invalidateQueries({ queryKey: getQueryKey('member', { me: undefined }) });
104+
return queryClient.invalidateQueries({ queryKey: ['member', 'me'] });
106105
},
107106
});
108107
};
109108

110109
export const useGetMembersMe = (option?: UseQueryOptions<MemberMeResponse>) => {
111110
return useQuery({
112-
queryKey: getQueryKey('member', { me: undefined }),
111+
queryKey: ['member', 'me'],
113112
queryFn: () => MEMBER_API.getMembersMe(),
114113
...option,
115114
});

src/apis/mission.ts

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import getQueryKey from '@/apis/getQueryKey';
1+
import { createQueryKeyFactory } from '@/apis/createQueryKeyFactory';
22
import { type MissionCategory, type MissionItemTypeWithRecordId, type MissionVisibility } from '@/apis/schema/mission';
33
import {
44
useMutation,
@@ -81,17 +81,23 @@ interface ModifyMissionResponse {
8181
visibility: string;
8282
}
8383

84+
const missionsQueryKey = ['missions'];
85+
8486
export const useGetMissions = (option?: UseQueryOptions<GetMissionsResponse>) => {
8587
return useQuery<GetMissionsResponse>({
86-
queryKey: getQueryKey('missions'),
88+
queryKey: missionsQueryKey,
8789
queryFn: MISSION_APIS.getMissions,
8890
...option,
8991
});
9092
};
9193

94+
const getMissionDetailQueryKey = createQueryKeyFactory<{
95+
missionId: string;
96+
}>('missionDetail');
97+
9298
export const useGetMissionDetail = (missionId: string, option?: UseQueryOptions<MissionContentType>) => {
9399
return useSuspenseQuery<MissionContentType>({
94-
queryKey: getQueryKey('missionDetail', { missionId }),
100+
queryKey: getMissionDetailQueryKey({ missionId }),
95101
queryFn: () => MISSION_APIS.getMissionDetail(missionId),
96102
...option,
97103
});
@@ -102,7 +108,7 @@ export const useGetMissionDetailNoSuspense = (
102108
option?: Omit<UseQueryOptions<MissionContentType>, 'enabled'>, // TODO 수정 필요, 임시 방편
103109
) => {
104110
return useQuery<MissionContentType>({
105-
queryKey: getQueryKey('missionDetail', { missionId }),
111+
queryKey: getMissionDetailQueryKey({ missionId }),
106112
queryFn: () => MISSION_APIS.getMissionDetail(missionId),
107113
enabled: Boolean(missionId),
108114
...option,
@@ -124,7 +130,7 @@ export const useDeleteMissionMutation = (missionId: string, option?: UseMutation
124130
return useMutation({
125131
mutationFn: () => MISSION_APIS.deleteMission(missionId),
126132
onSuccess: async (...data) => {
127-
await queryClient.invalidateQueries({ queryKey: getQueryKey('missions') });
133+
await queryClient.invalidateQueries({ queryKey: missionsQueryKey });
128134
option?.onSuccess?.(...data);
129135
},
130136
...option,

src/apis/record.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import getQueryKey from '@/apis/getQueryKey';
1+
import { createQueryKeyFactory } from '@/apis/createQueryKeyFactory';
22
import { type RecordType } from '@/apis/schema/record';
33
import { type UploadBaseRequest } from '@/apis/schema/upload';
44
import {
@@ -86,17 +86,19 @@ const RECORD_API = {
8686

8787
export default RECORD_API;
8888

89+
const getRecordQueryKey = createQueryKeyFactory<GetRecordsParams>('record');
90+
8991
export const useGetRecord = (params: GetRecordsParams, option?: UseQueryOptions<GetRecordsResponse>) => {
9092
return useQuery({
91-
queryKey: getQueryKey('record', params),
93+
queryKey: getRecordQueryKey(params),
9294
queryFn: () => RECORD_API.getRecords(params),
9395
...option,
9496
});
9597
};
9698

9799
export const useGetRecordDetail = (recordId: string, option?: UseQueryOptions<GetRecordDetailResponse>) => {
98100
return useSuspenseQuery({
99-
queryKey: getQueryKey('recordDetail', { recordId }),
101+
queryKey: ['recordDetail', recordId],
100102
queryFn: () => RECORD_API.getRecordDetail(recordId),
101103

102104
...option,

src/app/mypage/ProfileContent.tsx

+6-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function ProfileContent({ nickname, profileUrl }: { nickname: string; profileUrl
1010
<section className={containerCss}>
1111
<Link href={ROUTER.MYPAGE.PROFILE_MODIFY}>
1212
<div className={profileWrapperCss}>
13-
<Thumbnail size={'h52'} variant={'filled'} url={profileUrl} />
13+
<Thumbnail size={'h52'} variant={'filled'} url={addDummyQuery(profileUrl)} />
1414
<p className={nicknameCss}>{nickname}</p>
1515
<Icon name="arrow-forward" width={16} height={16} color="icon.secondary" />
1616
</div>
@@ -48,3 +48,8 @@ const nicknameCss = css({
4848
minWidth: '0',
4949
whiteSpace: 'nowrap',
5050
});
51+
52+
const addDummyQuery = (url?: string) => {
53+
if (!url) return '';
54+
return `${url}?dummy=${Math.random()}`;
55+
};

src/app/mypage/profile_modify/page.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ function ProfileModifyPage() {
106106
validMsg={massageState.validMsg}
107107
onTextButtonClick={handleDuplicateCheck}
108108
/>
109+
;
109110
</main>
110111
</>
111112
);
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,5 @@
11
type QueryList = {
2-
missions: undefined;
3-
missionDetail: {
4-
missionId: string;
5-
};
6-
7-
record: {
8-
missionId: number;
9-
yearMonth: string;
10-
};
11-
recordDetail: {
12-
recordId: string;
13-
};
14-
15-
member: {
16-
me: undefined;
17-
};
2+
//
183
};
194

205
/**
@@ -30,7 +15,7 @@ type QueryList = {
3015
const getQueryKey = <T extends keyof QueryList>(
3116
...[key, params]: undefined extends QueryList[T] ? [T] : [T, QueryList[T]]
3217
) => {
33-
return params ? [key, ...Object.entries(params)] : [key];
18+
return params ? [key, params] : [key];
3419
};
3520

3621
export default getQueryKey;

src/hooks/query/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export { default as QueryProvider } from './QueryProvider';
2+
export { default as getQueryKey } from './getQueryKey';

0 commit comments

Comments
 (0)