From 6e8752e6c429c008282fbf64fd600f5ac4b0269e Mon Sep 17 00:00:00 2001 From: Kenneth Trecy Tobias <19201.tobias.kennethtrecy.c@gmail.com> Date: Sun, 20 Nov 2022 19:01:25 +0800 Subject: [PATCH] fix(tag): add mechanism to manipulate the existence of the tag --- pages/tag/list.page.vue | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/pages/tag/list.page.vue b/pages/tag/list.page.vue index fb713d3d8..ff948a2db 100644 --- a/pages/tag/list.page.vue +++ b/pages/tag/list.page.vue @@ -24,7 +24,10 @@ :template-path="READ_TAG" :headers="headers" :list="tableData" - :may-edit="mayEditTag"/> + @archive="archive" + @restore="restore" + @batch-archive="batchArchive" + @batch-restore="batchRestore"/> (() => { return isPermitted }) -const mayEditTag = computed(() => { - const roles = userProfile.data.roles.data - const isPermitted = permissionGroup.hasOneRoleAllowed(roles, [ - UPDATE, - ARCHIVE_AND_RESTORE - ]) - - return isPermitted -}) const isLoaded = ref(true) const fetcher = new Fetcher() @@ -179,4 +174,23 @@ function clearOffset() { watch([ offset ], debouncedResetList) watch([ chosenSort, slug, existence ], clearOffset) + +const { + archive, + batchArchive, + batchRestore, + restore +} = makeExistenceOperators( + list, + fetcher, + { + existence, + offset + }, + selectedIDs, + { + isLoaded, + receivedErrors + } +)