authorize.tsx32 lines · main
| 1 | import { useParams } from 'common' |
| 2 | import Head from 'next/head' |
| 3 | import { useRouter } from 'next/router' |
| 4 | |
| 5 | import { ApiAuthorizationScreen } from '@/components/interfaces/ApiAuthorization/ApiAuthorization' |
| 6 | import { APIAuthorizationLayout } from '@/components/layouts/APIAuthorizationLayout' |
| 7 | import { withAuth } from '@/hooks/misc/withAuth' |
| 8 | import type { NextPageWithLayout } from '@/types' |
| 9 | |
| 10 | const APIAuthorizationPage: NextPageWithLayout = () => { |
| 11 | const router = useRouter() |
| 12 | const routerReady = router.isReady |
| 13 | const { auth_id, organization_slug } = useParams() |
| 14 | |
| 15 | if (!routerReady) { |
| 16 | return null |
| 17 | } |
| 18 | |
| 19 | return ( |
| 20 | <ApiAuthorizationScreen |
| 21 | auth_id={auth_id} |
| 22 | organization_slug={organization_slug} |
| 23 | navigate={(destination) => router.push(destination)} |
| 24 | /> |
| 25 | ) |
| 26 | } |
| 27 | |
| 28 | APIAuthorizationPage.getLayout = (page) => ( |
| 29 | <APIAuthorizationLayout HeadProvider={Head}>{page}</APIAuthorizationLayout> |
| 30 | ) |
| 31 | |
| 32 | export default withAuth(APIAuthorizationPage) |