30 lines
993 B
TypeScript
30 lines
993 B
TypeScript
import { defineStore } from "pinia";
|
|
import axios from "axios";
|
|
export const useRoleMode = defineStore("roleMode", () => {
|
|
const typeUser = ref<any>([]);
|
|
const roleMenuById = ref<any>([]);
|
|
const messages = ref<any>({});
|
|
const getRoleMenuById = async (body: Record<string, any>) => {
|
|
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 };
|
|
});
|