Created
August 23, 2022 09:24
-
-
Save trithien98/bd167f8cdbb5bb4b937aecb15a8ffd0f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| @action | |
| onChangePhotoUpload = async (event) => { | |
| const file = event?.target?.files?.[0] | |
| if (!file) { | |
| return | |
| } | |
| if (!file.type?.startsWith('image/')) { | |
| notifyStore.error('$ERRORS.ONLY_SUPPORT_IMAGE') | |
| return | |
| } | |
| const signedBlobId = await uploadFile(file) | |
| const fileUrl = URL?.createObjectURL(file) | |
| const image = { | |
| id: `${TEMP_ID}_${nanoid()}`, | |
| signedBlobId, | |
| filename: file.name, | |
| contentType: file.type, | |
| fileUrl, | |
| } | |
| this.timesheetImages = [...this.timesheetImages, image] | |
| this.saveFirebaseData(this.submitData.id) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment