data dari api

This commit is contained in:
2025-06-04 08:54:26 +07:00
parent 49770ba9f0
commit 3b288fd861
13 changed files with 385 additions and 36 deletions

21
stores/api/menu.ts Normal file
View File

@@ -0,0 +1,21 @@
import { defineStore } from "pinia";
import axios from "axios";
export const useMenu = defineStore("menu", () => {
const listMenu = ref<any>([]);
const getMenu = async () => {
// await $fetch("http://10.10.150.131:8080/api/menu/getlist", {
await $fetch("/api/menu/listMenu", {
// mode: "no-cors",
headers: {
"Content-Type": "application/json",
},
method:"GET",
})
.then((res) => {
listMenu.value = res
console.log(listMenu.value);
});
// return listMenu;
};
return { getMenu,listMenu };
});