Homepage, lepsi POI

This commit is contained in:
Michal Kváček
2023-08-23 21:40:32 +02:00
parent 8c3b8d19dd
commit 19b078b43c
33 changed files with 370 additions and 141 deletions
+2 -6
View File
@@ -2,6 +2,7 @@ import {defineStore} from 'pinia'
import {apolloWrapper} from "src/graphql/apollo"
import {FLIGHT_DETAIL, FLIGHTS_LIST} from "src/graphql/queries/flights";
import {EDIT_FLIGHT, CREATE_FLIGHT, DELETE_FLIGHT} from "src/graphql/mutations/flight";
import {updateInItems} from "stores/helpers";
export const useFlightsStore = defineStore('Flights', {
state: () => ({
@@ -26,12 +27,7 @@ export const useFlightsStore = defineStore('Flights', {
update(id, formData) {
return apolloWrapper.mutate(EDIT_FLIGHT, {id: id, input: formData}).then(({data}) => {
const flight = data.editFlight;
const idx = this.items.findIndex(item => item.id === id);
if (idx < 0) {
this.items.push(flight)
} else {
this.items[idx] = flight;
}
updateInItems(this.items, "id", flight);
return flight;
});