Skip to content

Instantly share code, notes, and snippets.

@ms314006
Last active August 6, 2023 04:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ms314006/3fe8f48dadb28d6c99e324edafe7ad11 to your computer and use it in GitHub Desktop.
Save ms314006/3fe8f48dadb28d6c99e324edafe7ad11 to your computer and use it in GitHub Desktop.
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