Verejna cast, hezci 404ka, refaktoring
This commit is contained in:
+11
-4
@@ -25,15 +25,22 @@ export const useFlightsStore = defineStore('Flights', {
|
||||
},
|
||||
update(id, formData) {
|
||||
return apolloWrapper.mutate(EDIT_FLIGHT, {id: id, input: formData}).then(({data}) => {
|
||||
console.log("Pridat update ve storu")
|
||||
return data.editFlight;
|
||||
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;
|
||||
}
|
||||
|
||||
return flight;
|
||||
});
|
||||
},
|
||||
fetchDetail(id) {
|
||||
fetchDetail(id, username) {
|
||||
if (typeof id !== "number") {
|
||||
id = parseInt(id);
|
||||
}
|
||||
return apolloWrapper.query(FLIGHT_DETAIL, {id}).then(result => result.data.flight);
|
||||
return apolloWrapper.query(FLIGHT_DETAIL, {id, username}).then(result => result.data.flight);
|
||||
},
|
||||
fetch(username) {
|
||||
return apolloWrapper
|
||||
|
||||
Reference in New Issue
Block a user