mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2026-01-02 20:59:28 -05:00
fixed file upload
This commit is contained in:
@@ -79,11 +79,20 @@ onMounted(() => {
|
||||
* save file to database via fileApi composable
|
||||
*/
|
||||
function saveFile() {
|
||||
loading.value = true
|
||||
|
||||
let event: ("create" | "save") = isUpdate() ? 'save' : 'create'
|
||||
|
||||
createOrUpdateUserFile(editingObj.value.name, file.value, editingObj.value.id).then(r => {
|
||||
editingObj.value = r
|
||||
editingObjChanged.value = false
|
||||
emit(event, r)
|
||||
useMessageStore().addPreparedMessage(PreparedMessage.UPDATE_SUCCESS)
|
||||
}).catch(err => {
|
||||
useMessageStore().addError(ErrorMessageType.UPDATE_ERROR, err)
|
||||
}).finally(() => {
|
||||
editingObjChanged.value = false
|
||||
loading.value = false
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user