-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
변경 사항 방 생성 기능 공유 기능 배너 캐로셀 UI 개선 마이 페이지 추가
- Loading branch information
Showing
132 changed files
with
4,459 additions
and
812 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import axios from 'axios'; | ||
|
||
import customAxios from '../util/request'; | ||
|
||
export const uploadImage = async (file: File): Promise<string | undefined> => { | ||
const preSignedUrl = await getPreSignedUrl(file.name); | ||
const imageUrl = await uploadToBucket(preSignedUrl, file); | ||
return imageUrl | ||
? `${preSignedUrl.data.url}${preSignedUrl.data.fields.key}` | ||
: ''; | ||
}; | ||
|
||
const getPreSignedUrl = async (fileName: string) => { | ||
const result: presignedUrlRes = await customAxios().get( | ||
`/meetings/presigned-url?file_name=${fileName}`, | ||
); | ||
return result; | ||
}; | ||
|
||
const uploadToBucket = async (preSignedUrl: presignedUrlRes, file: File) => { | ||
try { | ||
const formData = new FormData(); | ||
for (const [key, value] of Object.entries(preSignedUrl.data.fields)) { | ||
formData.append(key, value); | ||
} | ||
formData.append('file', file); | ||
await axios.post(preSignedUrl.data.url, formData); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
}; | ||
|
||
type presignedUrlRes = { | ||
data: { | ||
url: string; | ||
fields: { | ||
key: string; | ||
'x-amz-algorithm': string; | ||
'x-amz-credential': string; | ||
'x-amz-date': string; | ||
policy: string; | ||
'x-amz-signature': string; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.