From 509daeac1b2236c1e2e46bcc8db599bb339cb134 Mon Sep 17 00:00:00 2001 From: Julian Krauser Date: Wed, 18 Sep 2024 09:58:29 +0200 Subject: [PATCH] types --- src/components/admin/Permission.vue | 14 +++++++++----- .../CreateCommunicationTypeModal.vue | 3 ++- src/components/admin/user/role/RoleListItem.vue | 2 +- src/stores/admin/communicationType.ts | 3 ++- src/viewmodels/admin/role.models.ts | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/components/admin/Permission.vue b/src/components/admin/Permission.vue index 359ac18..0f2b50d 100644 --- a/src/components/admin/Permission.vue +++ b/src/components/admin/Permission.vue @@ -106,14 +106,15 @@ export default defineComponent({ default: {}, }, status: { - type: [ - null, - String as PropType<"loading">, - Object as PropType<{ status: "success" | "failed"; message?: string }>, - ], + type: [Object, String, null] as PropType, default: null, }, }, + watch: { + permissions() { + this.permissionUpdate = cloneDeep(this.permissions); + }, + }, emits: ["savePermissions"], data() { return { @@ -141,6 +142,9 @@ export default defineComponent({ const target = e.target as HTMLInputElement; this.isAdmin = target.checked ?? false; this.permissionUpdate.admin = this.isAdmin; + if (!this.isAdmin) { + delete this.permissionUpdate.admin; + } }, togglePermission(type: PermissionType, section: PermissionSection, modul?: PermissionModule) { let permissions = [] as Array | "*"; diff --git a/src/components/admin/settings/communicationType/CreateCommunicationTypeModal.vue b/src/components/admin/settings/communicationType/CreateCommunicationTypeModal.vue index e18f0e9..b6a33a1 100644 --- a/src/components/admin/settings/communicationType/CreateCommunicationTypeModal.vue +++ b/src/components/admin/settings/communicationType/CreateCommunicationTypeModal.vue @@ -82,6 +82,7 @@ import { useCommunicationTypeStore } from "@/stores/admin/communicationType"; import type { CreateCommunicationTypeViewModel } from "@/viewmodels/admin/communicationType.models"; import { Listbox, ListboxButton, ListboxOptions, ListboxOption, ListboxLabel } from "@headlessui/vue"; import { CheckIcon, ChevronUpDownIcon } from "@heroicons/vue/20/solid"; +import type { CommunicationFieldType } from "@/types/fieldTypes";