Skip to content

Commit

Permalink
모임 상세 조회 API 마이그레이션 (#897)
Browse files Browse the repository at this point in the history
* refactor: 모임 상세 조회 API 마이그레이션

* Delete src/api/API_LEGACY/meeting/index.ts

* fix: prettier 오류 해결

* fix: Data 구조 분해 및 타입 지정

* fix: ESLint 오류 해결

* refactor: 데이터 구조 변경
  • Loading branch information
j-nary authored Oct 1, 2024
1 parent 3efa4a7 commit 01ab1de
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 20 deletions.
17 changes: 3 additions & 14 deletions src/api/API_LEGACY/meeting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,10 @@ export const updateMeeting = async (meetingId: string, formData: FormType) => {
return response;
};

interface GetPresignedUrlResponse {
url: string;
fields: {
'Content-Type': string;
key: string;
bucket: string;
'X-Amz-Algorithm': string;
'X-Amz-Credential': string;
'X-Amz-Date': string;
Policy: string;
'X-Amz-Signature': string;
};
}
type GetPresignedUrlResponse =
paths['/meeting/v2/presigned-url']['get']['responses']['200']['content']['application/json;charset=UTF-8'];
export const getPresignedUrl = async (contentType: string) => {
const { data } = await api.get<Data<GetPresignedUrlResponse>>('/meeting/v1/presigned-url', {
const { data } = await api.get<GetPresignedUrlResponse>('/meeting/v2/presigned-url', {
params: { contentType },
});
return data;
Expand Down
4 changes: 1 addition & 3 deletions src/components/feed/Modal/FeedFormPresentation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ function FeedFormPresentation({

const uploadFile = async (file: File) => {
const extension = file.type.split('/')[1];
const {
data: { url, fields },
} = await getPresignedUrl(extension);
const { url, fields } = await getPresignedUrl(extension);
await uploadImage(file, url, fields);
const imageUrls = imageS3Bucket + fields.key;
return imageUrls;
Expand Down
4 changes: 1 addition & 3 deletions src/components/form/Presentation/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,7 @@ function Presentation({

const uploadFile = async (file: File) => {
const extension = file.type.split('/')[1];
const {
data: { url, fields },
} = await getPresignedUrl(extension);
const { url, fields } = await getPresignedUrl(extension);
await uploadImage(file, url, fields);
const imageUrls = imageS3Bucket + fields.key;
return imageUrls;
Expand Down

0 comments on commit 01ab1de

Please sign in to comment.