Last active
August 6, 2023 04:16
-
-
Save ms314006/3fe8f48dadb28d6c99e324edafe7ad11 to your computer and use it in GitHub Desktop.
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
const useCheckUserPermission = () => { | |
const { refetch: fetchUserProfile } = useUserProfile(userId); | |
const userProfile = await fetchUserProfile(); | |
const userPermissionHandler = new UserPermissionHandler(userProfile); | |
const guards = new Guards(); | |
guard.addGuards([ | |
{ isValid: userPermissionHandler.isLogin }, | |
{ isValid: userPermissionHandler.isMobileVerified }, | |
{ isValid: userPermissionHandler.isEmailVerified } | |
]); | |
return guards.execute(); | |
}; | |
// 使用時 | |
const { isValid } = useCheckUserPermission(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment