add: Form create load
This commit is contained in:
30
src/composables/useAttachments.js
Normal file
30
src/composables/useAttachments.js
Normal file
@@ -0,0 +1,30 @@
|
||||
import { ref } from "vue";
|
||||
import { useLoadsStore } from "../stores/loads";
|
||||
import api from "../lib/axios";
|
||||
|
||||
export default function useAttachments() {
|
||||
|
||||
const loading = ref(false);
|
||||
const attachments = ref(null);
|
||||
const loadStore = useLoadsStore();
|
||||
|
||||
const getAttachmentLoad = async() => {
|
||||
try {
|
||||
loading.value = true;
|
||||
const endpoint = "/v1" + "/load-attachments/load/" + loadStore.currentLoad._id;
|
||||
const {data} = await api.get(endpoint);
|
||||
attachments.value = data;
|
||||
} catch (error) {
|
||||
attachments.value = null;
|
||||
console.log(error);
|
||||
} finally {
|
||||
loading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
getAttachmentLoad,
|
||||
loading,
|
||||
attachments
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user