Skip to content

Commit 95b065d

Browse files
Fix(audience): 공지 저장 뷰 이미지 오류 해결 (#339)
* fix: 저장한 공지 뷰 이미지 렌더링 수정 * refactor: 타입 정리 * refactor: type import 적용
1 parent 8ecdee5 commit 95b065d

File tree

7 files changed

+36
-36
lines changed

7 files changed

+36
-36
lines changed

apps/audience/src/entities/notice/api/notice.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import type {
88
FestivalNoticesResponseData,
99
} from '@shared/types/notice-response';
1010

11+
import type { SavedNoticesResponse } from '../types/types';
12+
1113
type RequestOptions = {
1214
signal?: AbortSignal;
1315
};
@@ -46,3 +48,9 @@ export const postNoticeBookmark = (noticeId: number, isBookmarked: boolean) =>
4648
END_POINT.POST_NOTICE_BOOKMARK(noticeId),
4749
{ isBookmarked },
4850
);
51+
52+
export const getSavedNotices = (params: PageSizeParams = {}) =>
53+
get<SavedNoticesResponse, PageSizeParams>(
54+
END_POINT.GET_SAVED_NOTICES,
55+
params,
56+
);

apps/audience/src/entities/notice/model/query-options.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ import type { PageSizeParams } from '@amp/shared/types';
44

55
import { USERS_QUERY_KEY } from '@shared/constants/query-key';
66

7-
import { getFestivalBanner, getFestivalNotices } from '../api/notice';
7+
import {
8+
getFestivalBanner,
9+
getFestivalNotices,
10+
getSavedNotices,
11+
} from '../api/notice';
812

913
export const NOTICES_QUERY_OPTIONS = {
1014
LIST: (eventId: number, params: PageSizeParams = {}) =>
@@ -20,3 +24,11 @@ export const NOTICES_QUERY_OPTIONS = {
2024
enabled: Number.isFinite(festivalId),
2125
}),
2226
} as const;
27+
28+
export const SAVED_NOTICES_QUERY_OPTIONS = {
29+
LIST: (params: PageSizeParams = {}) =>
30+
queryOptions({
31+
queryKey: [...USERS_QUERY_KEY.SAVED_NOTICES(), params],
32+
queryFn: () => getSavedNotices(params),
33+
}),
34+
} as const;
Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,16 @@
1+
import type { Pagination } from '@shared/types';
2+
13
export interface SavedNoticeItem {
24
savedNoticeId: number;
35
noticeId: number;
46
festivalTitle: string;
57
categoryName: string;
68
content: string;
79
title: string;
8-
imageUrl: string;
9-
}
10-
11-
export interface SavedNoticesPagination {
12-
currentPage: number;
13-
totalPages: number;
14-
totalElements: number;
15-
size: number;
16-
hasNext: boolean;
17-
hasPrevious: boolean;
10+
imageUrls: string[];
1811
}
1912

2013
export interface SavedNoticesResponse {
2114
notices: SavedNoticeItem[];
22-
pagination: SavedNoticesPagination;
15+
pagination: Pagination;
2316
}

apps/audience/src/features/saved-notice/query.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

apps/audience/src/pages/saved-notices/saved-notices.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { generatePath, useNavigate } from 'react-router';
44
import { CardNotice, EmptyView } from '@amp/ads-ui';
55
import { Loading } from '@amp/compositions';
66

7-
import { SAVED_NOTICES_QUERY_OPTIONS } from '@features/saved-notice/query';
7+
import { SAVED_NOTICES_QUERY_OPTIONS } from '@entities/notice/model/query-options';
88

99
import { ROUTE_PATH } from '@shared/constants/path';
1010

@@ -36,7 +36,7 @@ const SavedNoticesPage = () => {
3636
{savedNoticesData.notices.map((notice, index) => (
3737
<div key={notice.noticeId}>
3838
<CardNotice
39-
imageUrls={notice.imageUrl ? [notice.imageUrl] : []}
39+
imageUrls={notice.imageUrls ?? []}
4040
title={notice.title}
4141
content={notice.content}
4242
onClick={() => {
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './pagination';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
export interface Pagination {
2+
currentPage: number;
3+
totalPages: number;
4+
totalElements: number;
5+
size: number;
6+
hasNext: boolean;
7+
hasPrevious: boolean;
8+
}

0 commit comments

Comments
 (0)