diff --git a/components/Master/formTypeUser.vue b/components/Master/formTypeUser.vue
index 76d67dd..b7d5168 100644
--- a/components/Master/formTypeUser.vue
+++ b/components/Master/formTypeUser.vue
@@ -1,9 +1,15 @@
diff --git a/components/layout/full/Main.vue b/components/layout/full/Main.vue
index 10b1179..877aaa7 100644
--- a/components/layout/full/Main.vue
+++ b/components/layout/full/Main.vue
@@ -88,7 +88,7 @@ watch([mdAndDown, () => props.items], ([mdVal, items]) => {
-
+
diff --git a/pages/Setting/typeUser/index.vue b/pages/Setting/typeUser/index.vue
index 780d3ae..d6746e2 100644
--- a/pages/Setting/typeUser/index.vue
+++ b/pages/Setting/typeUser/index.vue
@@ -21,7 +21,7 @@ onMounted(async() => {
-
+ mdi-plus Tipe User
diff --git a/stores/api/setting/setting2.ts b/stores/api/setting/setting2.ts
new file mode 100644
index 0000000..642912e
--- /dev/null
+++ b/stores/api/setting/setting2.ts
@@ -0,0 +1,106 @@
+import { defineStore } from 'pinia'
+const runtime = useRuntimeConfig().public;
+interface Setting {
+ listTypeUser: [];
+ listMenu: [];
+ roleMenuById: [];
+ message: string;
+}
+export const useMySetting2Store = defineStore('mySetting2Store', {
+ // id: 'mySetting2Store',
+ state: (): Setting => ({
+ listTypeUser: [],
+ listMenu: [],
+ roleMenuById: [],
+ message: ''
+ }),
+ actions: {
+ async getMenu() {
+ try {
+ const response = await $fetch(`${runtime.APIBASE}/menu/getlist`, {
+ method: "GET",
+ headers: { "Content-Type": "application/json" }
+ })
+ this.listMenu = response as []
+ } catch (error) {
+ if (error instanceof Error) {
+ this.message = error.message
+ // console.log(error.message)
+ }
+ }
+ },
+ async getRoleMenuById(body: Record) {
+ try {
+ console.log(body)
+ const response = await $fetch(`${runtime.APIBASE}/menu/role/type/${body}`, {
+ headers: {
+ "Content-Type": "application/json",
+ },
+ method: "GET",
+ })
+ this.roleMenuById = response as []
+ } catch (error) {
+ if (error instanceof Error) {
+ this.message = error.message
+ // console.log(error.message)
+ }
+ }
+ },
+ async getTypeUser() {
+ try {
+ const response = await $fetch(`${runtime.APIBASE}/menu/type`, {
+ method: "GET",
+ headers: { "Content-Type": "application/json" }
+ })
+ this.listTypeUser = response as []
+ } catch (error) {
+ if (error instanceof Error) {
+ this.message = error.message
+ // console.log(error.message)
+ }
+ }
+ },
+ async postRoleUserMenu(body: Record) {
+ try {
+ const roleUserMenu = body.menus.map((item) => ({
+ type_user_id: item.type_user_id,
+ menu_id: item.menu_id,
+ access: [
+ {
+ add: parseInt(item.access[0].value),
+ update: parseInt(item.access[1].value),
+ read: parseInt(item.access[2].value),
+ delete: parseInt(item.access[3].value),
+ }
+ ]
+ }))
+ console.log("body post:", body.menus)
+ const response = await $fetch(`${runtime.APIBASE}/menu/update/rolemenu?id=${body.menus[0].type_user_id}`, {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(roleUserMenu)
+ })
+ } catch (error) {
+ if (error instanceof Error) {
+ this.message = error.message
+ // console.log(error.message)
+ }
+ }
+ }
+ // async addTypeUser(data: any) {
+ // console.log(data)
+ // try {
+ // const response = await $fetch('https://',{
+ // method: 'POST',
+ // headers: {'Content-Type': 'application/json'},
+ // body: JSON.stringify(data)
+ // })
+ // } catch (error) {
+ // if(error instanceof Error){
+ // this.message = error.message
+ // // console.log(error.message)
+ // }
+ // }
+ // }
+ }
+})