Prace s mapu, zobrazeni GPX, editace kopilota, skeletony

This commit is contained in:
Michal Kváček
2023-08-07 23:22:28 +02:00
parent 09d2f25523
commit c4603cf090
55 changed files with 891 additions and 408 deletions
+18 -9
View File
@@ -1,26 +1,35 @@
import {defineStore} from 'pinia'
import {apolloWrapper} from "src/graphql/apollo";
import {COPILOTS_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots";
import {COPILOT_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots";
import {CREATE_COPILOT, EDIT_COPILOT} from "src/graphql/mutations/copilot";
export const useCopilotsStore = defineStore('SecondPilots', {
state: () => ({
items: []
}),
getters: {},
actions: {
create(formData) {
console.log("not implemented");
},
fetchDetail(copilotId) {
return apolloWrapper.query(COPILOTS_DETAIL, {id: copilotId}).then(({data}) => data.copilot);
return apolloWrapper.query(COPILOT_DETAIL, {id: copilotId}).then(({data}) => data.copilot);
},
fetch() {
return apolloWrapper.query(COPILOTS_LIST).then(result => {
return apolloWrapper.query(COPILOTS_LIST).then(result => {
this.items = result.data.copilots;
return result.data.copilots;
});
}
},
create(formData) {
delete formData['id'];
return apolloWrapper.mutate(CREATE_COPILOT, {input: formData}).then(({data}) => {
this.items.push(data.createCopilot);
return data.createCopilot;
})
},
update(id, formData) {
return apolloWrapper.mutate(EDIT_COPILOT, {id: id, input: formData}).then(({data}) => {
return data.editCopilot;
});
},
}
})