diff --git a/components/Master/CardList.vue b/components/Master/CardList.vue index f161e68..bee572a 100644 --- a/components/Master/CardList.vue +++ b/components/Master/CardList.vue @@ -27,6 +27,8 @@ const state = ref(false) Detail --> + + diff --git a/components/Master/formDetail1.vue b/components/Master/formDetail1.vue index 4a14b34..a9fed20 100644 --- a/components/Master/formDetail1.vue +++ b/components/Master/formDetail1.vue @@ -77,7 +77,7 @@ onMounted(async () => { console.log('aaaaa', data.value); }); - +const form = ref({}) // Helper function to create checkbox config const createCheckbox = (namePrefix: string, menu: any) => { const accessMap = { @@ -126,12 +126,12 @@ const createMenuRow = (menu: any) => { :rows="1+data.length" :grid="[ [ - ['No', 1, 1, null, null], - ['Nama Menu', 1, 1, null, null], - ['Tambah', 1, 1, null, null], - ['Ubah', 1, 1, null, null], - ['Baca', 1, 1, null, null], - ['Hapus', 1, 1, null, null], + ['No', 1, 1, null, null], + ['Nama Menu', 1, 1, null, null], + ['Tambah', 1, 1, null, null], + ['Ubah', 1, 1, null, null], + ['Baca', 1, 1, null, null], + ['Hapus', 1, 1, null, null], ], ...data.map((menu:any) => createMenuRow(menu)) ]" diff --git a/pages/Setting/typeUser/index.vue b/pages/Setting/typeUser/index.vue index efa6398..1bac61b 100644 --- a/pages/Setting/typeUser/index.vue +++ b/pages/Setting/typeUser/index.vue @@ -16,7 +16,7 @@ const {typeUser} =storeToRefs(useRoleMode()) const state = ref(false) const type = ref('') const detailType = async(item:any) => { - // console.log(item._id); //simpan pinia + console.log(item._id); //simpan pinia await getRoleMenuById(item._id) type.value='detail' state.value= true @@ -31,6 +31,7 @@ onMounted(async() => { diff --git a/stores/api/menu.ts b/stores/api/menu.ts index 3b457d5..ef470af 100644 --- a/stores/api/menu.ts +++ b/stores/api/menu.ts @@ -2,6 +2,7 @@ import { defineStore } from "pinia"; import axios from "axios"; export const useMenu = defineStore("menu", () => { const listMenu = ref([]); + const messages = ref({}); const getMenu = async () => { // await $fetch("http://10.10.150.131:8080/api/menu/getlist", { await $fetch("/api/menu/listMenu", { @@ -14,7 +15,11 @@ export const useMenu = defineStore("menu", () => { .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 }; diff --git a/stores/api/roleMenu.ts b/stores/api/roleMenu.ts index 5e71271..e8bd124 100644 --- a/stores/api/roleMenu.ts +++ b/stores/api/roleMenu.ts @@ -3,6 +3,7 @@ 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); @@ -17,7 +18,11 @@ export const useRoleMode = defineStore("roleMode", () => { }).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 }; diff --git a/stores/api/sidebar.ts b/stores/api/sidebar.ts index 157d5fb..822ca2e 100644 --- a/stores/api/sidebar.ts +++ b/stores/api/sidebar.ts @@ -1,5 +1,5 @@ -import axios from 'axios' -import { defineStore } from 'pinia' +import axios from "axios"; +import { defineStore } from "pinia"; // export const useMySidebarStore = defineStore({ // id: 'mySidebarStore', @@ -7,22 +7,24 @@ import { defineStore } from 'pinia' // actions: {} // }) -export const useSidebarStore = defineStore('SidebarStore', () => { - const getSidebar = async () => { - console.log('aaaaa') - const res = await $fetch(`http://10.10.150.131:8080/api/login/6835632801e46cf9c5551876`, { - mode: 'no-cors', - headers: { - 'Access-Control-Allow-Origin': '*', - Accept: 'application/json', - 'Content-Type': 'application/json', - }, - }) - .then((response) => { - console.log(response) - }) - } - return { - getSidebar - } -}) \ No newline at end of file +export const useSidebarStore = defineStore("SidebarStore", () => { + const getSidebar = async () => { + console.log("aaaaa"); + const res = await $fetch( + `http://10.10.150.131:8080/api/login/6835632801e46cf9c5551876`, + { + mode: "no-cors", + headers: { + "Access-Control-Allow-Origin": "*", + Accept: "application/json", + "Content-Type": "application/json", + }, + } + ).then((response) => { + console.log(response); + }); + }; + return { + getSidebar, + }; +}); diff --git a/stores/api/typeUser.ts b/stores/api/typeUser.ts index 6e0c473..a41aa5b 100644 --- a/stores/api/typeUser.ts +++ b/stores/api/typeUser.ts @@ -2,6 +2,7 @@ import { defineStore } from "pinia"; import axios from "axios"; export const useTypeUser = defineStore("typeUser", () => { const listTypeUser = ref([]); + const messages = ref({}); const getTypeUser = async () => { // await $fetch("http://10.10.150.131:8080/api/menu/type", { await $fetch("/api/typeUser/listTypeUser", { @@ -16,7 +17,11 @@ export const useTypeUser = defineStore("typeUser", () => { .then((res) => { listTypeUser.value = res // console.log(listTypeUser.value); - }); + }).catch((error) => { + console.log(`Info Error : ${error}`) + messages.value.title = 'Sambungan Sever Terputus!!!'; + messages.value.type = 'error'; + }); // return listTypeUser; }; return { getTypeUser,listTypeUser };