Upravy UI, refaktoring, davkove upravy a mazani fotek
This commit is contained in:
+8
-3
@@ -3,6 +3,9 @@ import {apolloWrapper} from "src/graphql/apollo";
|
||||
import {DELETE_PHOTO, EDIT_PHOTO, UPLOAD_PHOTO} from "src/graphql/mutations/photo";
|
||||
|
||||
export const usePhotosStore = defineStore('photos', {
|
||||
state: () => ({
|
||||
isMutationRunning: false,
|
||||
}),
|
||||
|
||||
actions: {
|
||||
upload(flightId, formData) {
|
||||
@@ -20,15 +23,17 @@ export const usePhotosStore = defineStore('photos', {
|
||||
if (!formData.description) {
|
||||
formData.description = "";
|
||||
}
|
||||
|
||||
this.isMutationRunning = true;
|
||||
return apolloWrapper.mutate(UPLOAD_PHOTO, {input: formData}).then(({data}) => {
|
||||
return data.uploadPhoto;
|
||||
})
|
||||
}).finally(() => this.isMutationRunning = false);
|
||||
},
|
||||
update(id, formData) {
|
||||
|
||||
this.isMutationRunning = true;
|
||||
return apolloWrapper.mutate(EDIT_PHOTO, {id, input: formData}).then(({data}) => {
|
||||
return data.editPhoto;
|
||||
})
|
||||
}).finally(() => this.isMutationRunning = false);
|
||||
},
|
||||
delete(photoId) {
|
||||
return apolloWrapper.mutate(DELETE_PHOTO, {id: photoId}).then(({data}) => {
|
||||
|
||||
Reference in New Issue
Block a user