index.tsx39 lines · main
| 1 | import { PermissionAction } from '@supabase/shared-types/out/constants' |
| 2 | import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader' |
| 3 | |
| 4 | import { JWTSecretKeysTable } from '@/components/interfaces/JwtSecrets/jwt-secret-keys-table' |
| 5 | import DefaultLayout from '@/components/layouts/DefaultLayout' |
| 6 | import JWTKeysLayout from '@/components/layouts/JWTKeys/JWTKeysLayout' |
| 7 | import SettingsLayout from '@/components/layouts/ProjectSettingsLayout/SettingsLayout' |
| 8 | import NoPermission from '@/components/ui/NoPermission' |
| 9 | import { useAsyncCheckPermissions } from '@/hooks/misc/useCheckPermissions' |
| 10 | import type { NextPageWithLayout } from '@/types' |
| 11 | |
| 12 | const JWTSigningKeysPage: NextPageWithLayout = () => { |
| 13 | const { can: canReadAPIKeys, isSuccess: isPermissionsLoaded } = useAsyncCheckPermissions( |
| 14 | PermissionAction.READ, |
| 15 | 'auth_signing_keys' |
| 16 | ) |
| 17 | |
| 18 | return ( |
| 19 | <> |
| 20 | {!isPermissionsLoaded ? ( |
| 21 | <GenericSkeletonLoader /> |
| 22 | ) : !canReadAPIKeys ? ( |
| 23 | <NoPermission isFullPage resourceText="access your project's API keys" /> |
| 24 | ) : ( |
| 25 | <JWTSecretKeysTable /> |
| 26 | )} |
| 27 | </> |
| 28 | ) |
| 29 | } |
| 30 | |
| 31 | JWTSigningKeysPage.getLayout = (page) => ( |
| 32 | <DefaultLayout> |
| 33 | <SettingsLayout title="jwt keys"> |
| 34 | <JWTKeysLayout>{page}</JWTKeysLayout> |
| 35 | </SettingsLayout> |
| 36 | </DefaultLayout> |
| 37 | ) |
| 38 | |
| 39 | export default JWTSigningKeysPage |