thainv-dev: tạo lại cấu trúc folder và làm UI
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user