Skip to content

Commit 4980c44

Browse files
authored
Revert "Revert "배포용 pr""
1 parent 0184968 commit 4980c44

File tree

9 files changed

+35
-33
lines changed

9 files changed

+35
-33
lines changed

next.config.js

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
9;
12
/** @type {import('next').NextConfig} */
23
const nextConfig = {
34
experimental: {
@@ -11,6 +12,11 @@ const nextConfig = {
1112
hostname: 'kr.object.ncloudstorage.com',
1213
port: '',
1314
},
15+
{
16+
protocol: 'https',
17+
hostname: 'image.10mm.today',
18+
port: '',
19+
},
1420
],
1521
},
1622
};

src/apis/createQueryKeyFactory.ts

-5
This file was deleted.

src/hooks/query/getQueryKey.ts src/apis/getQueryKey.ts

+17-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
type QueryList = {
2-
//
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+
};
318
};
419

520
/**
@@ -15,7 +30,7 @@ type QueryList = {
1530
const getQueryKey = <T extends keyof QueryList>(
1631
...[key, params]: undefined extends QueryList[T] ? [T] : [T, QueryList[T]]
1732
) => {
18-
return params ? [key, params] : [key];
33+
return params ? [key, ...Object.entries(params)] : [key];
1934
};
2035

2136
export default getQueryKey;

src/apis/member.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import getQueryKey from '@/apis/getQueryKey';
12
import apiInstance from '@/apis/instance.api';
23
import { type MemberType } from '@/apis/schema/member';
34
import { type UploadBaseRequest, type UploadUrlBaseResponse } from '@/apis/schema/upload';
@@ -101,14 +102,14 @@ export const useUploadProfileImageComplete = (
101102
...option,
102103
onSuccess: (...res) => {
103104
option?.onSuccess && option.onSuccess(...res);
104-
return queryClient.invalidateQueries({ queryKey: ['member', 'me'] });
105+
return queryClient.invalidateQueries({ queryKey: getQueryKey('member', { me: undefined }) });
105106
},
106107
});
107108
};
108109

109110
export const useGetMembersMe = (option?: UseQueryOptions<MemberMeResponse>) => {
110111
return useQuery({
111-
queryKey: ['member', 'me'],
112+
queryKey: getQueryKey('member', { me: undefined }),
112113
queryFn: () => MEMBER_API.getMembersMe(),
113114
...option,
114115
});

src/apis/mission.ts

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

84-
const missionsQueryKey = ['missions'];
85-
8684
export const useGetMissions = (option?: UseQueryOptions<GetMissionsResponse>) => {
8785
return useQuery<GetMissionsResponse>({
88-
queryKey: missionsQueryKey,
86+
queryKey: getQueryKey('missions'),
8987
queryFn: MISSION_APIS.getMissions,
9088
...option,
9189
});
9290
};
9391

94-
const getMissionDetailQueryKey = createQueryKeyFactory<{
95-
missionId: string;
96-
}>('missionDetail');
97-
9892
export const useGetMissionDetail = (missionId: string, option?: UseQueryOptions<MissionContentType>) => {
9993
return useSuspenseQuery<MissionContentType>({
100-
queryKey: getMissionDetailQueryKey({ missionId }),
94+
queryKey: getQueryKey('missionDetail', { missionId }),
10195
queryFn: () => MISSION_APIS.getMissionDetail(missionId),
10296
...option,
10397
});
@@ -108,7 +102,7 @@ export const useGetMissionDetailNoSuspense = (
108102
option?: Omit<UseQueryOptions<MissionContentType>, 'enabled'>, // TODO 수정 필요, 임시 방편
109103
) => {
110104
return useQuery<MissionContentType>({
111-
queryKey: getMissionDetailQueryKey({ missionId }),
105+
queryKey: getQueryKey('missionDetail', { missionId }),
112106
queryFn: () => MISSION_APIS.getMissionDetail(missionId),
113107
enabled: Boolean(missionId),
114108
...option,
@@ -130,7 +124,7 @@ export const useDeleteMissionMutation = (missionId: string, option?: UseMutation
130124
return useMutation({
131125
mutationFn: () => MISSION_APIS.deleteMission(missionId),
132126
onSuccess: async (...data) => {
133-
await queryClient.invalidateQueries({ queryKey: missionsQueryKey });
127+
await queryClient.invalidateQueries({ queryKey: getQueryKey('missions') });
134128
option?.onSuccess?.(...data);
135129
},
136130
...option,

src/apis/record.ts

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

8787
export default RECORD_API;
8888

89-
const getRecordQueryKey = createQueryKeyFactory<GetRecordsParams>('record');
90-
9189
export const useGetRecord = (params: GetRecordsParams, option?: UseQueryOptions<GetRecordsResponse>) => {
9290
return useQuery({
93-
queryKey: getRecordQueryKey(params),
91+
queryKey: getQueryKey('record', params),
9492
queryFn: () => RECORD_API.getRecords(params),
9593
...option,
9694
});
9795
};
9896

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

104102
...option,

src/app/mypage/ProfileContent.tsx

+1-6
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={addDummyQuery(profileUrl)} />
13+
<Thumbnail size={'h52'} variant={'filled'} url={profileUrl} />
1414
<p className={nicknameCss}>{nickname}</p>
1515
<Icon name="arrow-forward" width={16} height={16} color="icon.secondary" />
1616
</div>
@@ -48,8 +48,3 @@ 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,7 +106,6 @@ function ProfileModifyPage() {
106106
validMsg={massageState.validMsg}
107107
onTextButtonClick={handleDuplicateCheck}
108108
/>
109-
;
110109
</main>
111110
</>
112111
);

src/hooks/query/index.ts

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

0 commit comments

Comments
 (0)