fix: requests

This commit is contained in:
2026-03-31 12:22:21 +02:00
parent 1fa6206b75
commit fb4f7048ab
7 changed files with 183 additions and 163 deletions

View File

@@ -1,12 +1,19 @@
import { useFetchJson } from "@/composable/useFetchJson";
import type { MenuItem, Route } from "@/types/menu";
import { ref } from "vue";
import { settings } from "./settings";
const categoryId = ref()
export const getMenu = async () => {
const resp = await useFetchJson<MenuItem>('/api/v1/restricted/menu/get-menu');
if(!categoryId.value){
categoryId.value = settings['app'].category_tree_root_id
}
const resp = await useFetchJson<MenuItem>(`/api/v1/restricted/menu/get-category-tree?root_category_id=${categoryId.value}`);
return resp.items.children
}
export const getRoutes = async () => {
const resp = await useFetchJson<Route[]>('/api/v1/public/menu/get-routes');

View File

@@ -8,4 +8,6 @@ export const settings = reactive({} as Settings)
export async function getSettings() {
const { items } = await useFetchJson<Resp<Settings>>('/api/v1/settings',)
Object.assign(settings, items)
console.log(settings['app'])
}