Prepracovana prace s datem, lepsi input na datetime

This commit is contained in:
Michal Kváček
2023-07-03 13:24:18 +02:00
parent d399e1aaf1
commit 3d88397d21
24 changed files with 414 additions and 191 deletions
-1
View File
@@ -2,7 +2,6 @@ import {defineStore} from 'pinia'
import {apolloWrapper} from "src/graphql/apollo";
import {AIRCRAFT_DETAIL, AIRCRAFTS_LIST} from "src/graphql/queries/aircrafts";
import {CREATE_AIRCRAFT, DELETE_AIRCRAFT, EDIT_AIRCRAFT} from "src/graphql/mutations/aircrafts";
import {reactive} from "vue";
export const useAircraftsStore = defineStore('Aircrafts', {
state: () => ({
+1
View File
@@ -36,6 +36,7 @@ export const useFlightsStore = defineStore('Flights', {
return apolloWrapper.query(FLIGHT_DETAIL, {id}).then(result => result.data.flight);
},
fetch() {
console.log("flights fetch");
return apolloWrapper
.query(FLIGHTS_LIST)
.then((result) => {
+28
View File
@@ -0,0 +1,28 @@
import {defineStore} from "pinia";
import {apolloWrapper} from "src/graphql/apollo";
import {UPLOAD_PHOTO} from "src/graphql/mutations/photo";
export const usePhotosStore = defineStore('photos', {
actions: {
upload(flightId, formData) {
if (!flightId) {
console.error("No flightId specified for photo upload! Aborting");
return;
}
formData.flightId = flightId;
if (!formData.name) {
formData.name = "";
}
if (!formData.description) {
formData.description = "";
}
return apolloWrapper.mutate(UPLOAD_PHOTO, {input: formData}).then(({data}) => {
return data.uploadPhoto;
})
},
}
});