Skip to content

Commit e880c2c

Browse files
committed
fix: 불필요 파일 삭제
1 parent c18131c commit e880c2c

File tree

11 files changed

+10
-1819
lines changed

11 files changed

+10
-1819
lines changed

pages/api/cover-image.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import type { NextApiRequest, NextApiResponse } from 'next';
22

3-
import { getPage, getPageCoverImage } from '@/utils';
3+
import { notionClient } from '@/utils';
44

55
import { IMAGE_MAX_AGE } from '@/assets/constants';
66

77
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
88
const { pageId } = req.query;
99

1010
try {
11-
const recordMap = await getPage(pageId as string);
12-
const notionCoverUrl = getPageCoverImage(recordMap) as unknown as URL;
11+
const properties = await notionClient.getPageProperties(pageId as string);
12+
const notionCoverUrl = properties?.coverUrl || '';
1313
const response = await fetch(notionCoverUrl);
1414
const contentType = response.headers.get('content-type');
1515

src/interfaces/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {
44
GetPageResponse,
55
} from 'notion-to-utils';
66

7-
import { PreviewImage } from '@/interfaces/notion';
8-
97
export type { PageObjectResponse, GetPageResponse };
108
export type SelectPropertyResponse = MultiSelectPropertyItemObjectResponse['multi_select'][number];
119
export type SelectColor = SelectPropertyResponse['color'];
@@ -24,6 +22,12 @@ export interface Post {
2422
previewImage?: PreviewImage | null;
2523
}
2624

25+
export interface PreviewImage {
26+
originalWidth: number;
27+
originalHeight: number;
28+
dataURIBase64: string;
29+
}
30+
2731
export type SlugAndDate = Pick<Post, 'slug' | 'published'>;
2832
export interface Category extends SelectPropertyResponse {
2933
count?: number;

0 commit comments

Comments
 (0)