import {defineStore} from 'pinia' import {apolloWrapper} from "src/graphql/apollo"; import {COPILOTS_DETAIL, COPILOTS_LIST} from "src/graphql/queries/copilots"; 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); }, fetch() { return apolloWrapper.query(COPILOTS_LIST).then(result => { this.items = result.data.copilots; return result.data.copilots; }); } } })