fix: requests
This commit is contained in:
@@ -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');
|
||||
|
||||
|
||||
@@ -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'])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user