Otaceni fotek

This commit is contained in:
Michal Kváček
2023-09-21 09:39:22 +02:00
parent d1baec342f
commit b64c426179
6 changed files with 85 additions and 21 deletions
+7 -1
View File
@@ -1,6 +1,6 @@
import {defineStore} from "pinia";
import {apolloWrapper} from "src/graphql/apollo";
import {DELETE_PHOTO, EDIT_PHOTO, UPLOAD_PHOTO} from "src/graphql/mutations/photo";
import {DELETE_PHOTO, EDIT_PHOTO, ROTATE_PHOTO, UPLOAD_PHOTO} from "src/graphql/mutations/photo";
export const usePhotosStore = defineStore('Photos', {
state: () => ({
@@ -35,6 +35,12 @@ export const usePhotosStore = defineStore('Photos', {
return data.editPhoto;
}).finally(() => this.isMutationRunning = false);
},
rotate(id, angle) {
this.isMutationRunning = true;
return apolloWrapper.mutate(ROTATE_PHOTO, {id, angle}).then(({data}) => {
return data.rotatePhoto;
}).finally(() => this.isMutationRunning = false);
},
delete(photoId) {
return apolloWrapper.mutate(DELETE_PHOTO, {id: photoId}).then(({data}) => {
return data.deletePhoto;