thainv-dev: tạo lại cấu trúc folder và làm UI

This commit is contained in:
nguyen van thai
2024-06-12 17:17:49 +07:00
parent c217ed82c9
commit 5b1e0af397
44 changed files with 2674 additions and 228 deletions
+8 -6
View File
@@ -24,20 +24,22 @@ export type Category = {
status: number;
} & Base;
export type CategoryTree = Category & {
children?: Category[]
}
export const list = async () => {
console.log('vào category service')
try {
const { site, apiUrl } = useRuntimeConfig().public;
const {items}:any = await $fetch(`${apiUrl}/cms/category/site`, {
const { items }: CategoryTree[] | any = await $fetch(`${apiUrl}/cms/category/tree/site:1`, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
site: site,
site: 1,
},
});
return items;
return { items } ;
} catch (error) {
handleError(error);
}