feat: ตัวเเปร workNameItems

This commit is contained in:
Net 2024-06-21 15:58:42 +07:00
parent 2b0b1b7f8c
commit eb41274a50

View file

@ -19,9 +19,13 @@ import {
ProductOnWork,
WorkCreate,
} from './types';
import { ref } from 'vue';
const useProductServiceStore = defineStore('api-product-service', () => {
// Product Type
const workNameItems = ref<string[]>([]);
async function fetchStatsProductType() {
const res = await api.get('/product-type/stats');
@ -666,7 +670,17 @@ const useProductServiceStore = defineStore('api-product-service', () => {
return false;
}
async function fetchListOfWork() {
const res = await fetchListWork();
if (res) {
workNameItems.value = res.result.map((item) => item.name);
}
}
return {
workNameItems,
fetchStatsProductType,
fetchListProductServiceByIdType,
fetchListProductServiceType,
@ -702,6 +716,8 @@ const useProductServiceStore = defineStore('api-product-service', () => {
editWork,
deleteWork,
fetchListProductByIdWork,
fetchListOfWork,
};
});