24 lines
713 B
JavaScript
24 lines
713 B
JavaScript
import {ref} from "vue";
|
|
import {useCopilotsStore} from "stores/Copilots";
|
|
import {storeToRefs} from "pinia";
|
|
|
|
export const loading = ref(true);
|
|
export const copilot = ref(null);
|
|
export const fetchCopilot = (copilotId) => {
|
|
loading.value = true;
|
|
return useCopilotsStore().fetchDetail(parseInt(copilotId))
|
|
.then(resp => {
|
|
copilot.value = resp;
|
|
return resp;
|
|
})
|
|
.finally(() => loading.value = false);
|
|
}
|
|
|
|
export const copilots = storeToRefs(useCopilotsStore()).items;
|
|
export const fetchCopilots = () => {
|
|
loading.value = true;
|
|
return useCopilotsStore().fetch().finally(() => loading.value = false);
|
|
}
|
|
|
|
export const isRequestPending = storeToRefs(useCopilotsStore()).isMutationRunning;
|