import { defineStore } from "pinia"; import axios from "axios"; export const useRoleMode = defineStore("roleMode", () => { const typeUser = ref([]); const roleMenuById = ref([]); const messages = ref({}); const getRoleMenuById = async (body: Record) => { typeUser.value = body; // console.log(typeUser.value); // await $fetch("http://10.10.150.131:8080/api/menu/getlist", { await $fetch(`/api/roleMenu/roleMenu`, { // mode: "no-cors", headers: { "Content-Type": "application/json", }, method: "POST", body: JSON.stringify(body), }).then((res) => { roleMenuById.value = res; // console.log(roleMenuById.value); }).catch((error) => { console.log(`Info Error : ${error}`) messages.value.title = 'Sambungan Sever Terputus!!!'; messages.value.type = 'error'; }); // return roleMenuById; }; return { getRoleMenuById, roleMenuById, typeUser }; });