Prepracovana prace s datem, lepsi input na datetime
This commit is contained in:
@@ -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: () => ({
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -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;
|
||||
})
|
||||
},
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user