27 lines
789 B
TypeScript
27 lines
789 B
TypeScript
import { defineStore } from "pinia";
|
|
import axios from "axios";
|
|
export const useMenu = defineStore("menu", () => {
|
|
const listMenu = ref<any>([]);
|
|
const messages = 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);
|
|
}).catch((error) => {
|
|
console.log(`Info Error : ${error}`)
|
|
messages.value.title = 'Sambungan Sever Terputus!!!';
|
|
messages.value.type = 'error';
|
|
})
|
|
// return listMenu;
|
|
};
|
|
return { getMenu,listMenu };
|
|
});
|