-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: create page editable status custom hook
Signed-off-by: NaYeong,Kim <[email protected]>
- Loading branch information
Showing
38 changed files
with
141 additions
and
818 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
apps/web/src/common/composables/page-editable-status/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { computed, reactive } from 'vue'; | ||
|
||
import { useUserStore } from '@/store/user/user-store'; | ||
|
||
import type { PageAccessMap } from '@/lib/access-control/config'; | ||
|
||
import { useCurrentMenuId } from '@/common/composables/current-menu-id'; | ||
|
||
export const usePageEditableStatus = (): boolean|undefined => { | ||
const userStore = useUserStore(); | ||
const userGetters = userStore.getters; | ||
|
||
const storeState = reactive({ | ||
pageAccessPermissionMap: computed<PageAccessMap>(() => userGetters.pageAccessPermissionMap), | ||
}); | ||
|
||
return storeState.pageAccessPermissionMap[useCurrentMenuId()]?.write; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.