-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: getNavigationRoot and getAllUrlsFromDocsConfig should both …
…have the same parameter order
- Loading branch information
1 parent
03d5f20
commit 0f76888
Showing
12 changed files
with
51 additions
and
54 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,40 @@ | ||
import { getNotFoundPageStaticProps, NotFoundPage } from "@fern-ui/ui"; | ||
import { buildUrl } from "@fern-ui/fdr-utils"; | ||
import { REGISTRY_SERVICE } from "@fern-ui/ui"; | ||
import { GetStaticProps } from "next"; | ||
import dynamic from "next/dynamic"; | ||
import { useRouter } from "next/router"; | ||
|
||
export const getStaticProps = getNotFoundPageStaticProps; | ||
export declare namespace NotFoundPage { | ||
export interface Props { | ||
basePath: string | null; | ||
} | ||
} | ||
|
||
const Core: React.FC<NotFoundPage.Props> = ({ basePath }) => { | ||
const router = useRouter(); | ||
void router.push(basePath ?? "/"); | ||
return null; | ||
}; | ||
|
||
const NotFoundPage = dynamic(() => Promise.resolve(Core), { | ||
ssr: false, | ||
}); | ||
|
||
export default NotFoundPage; | ||
|
||
export const getStaticProps: GetStaticProps<NotFoundPage.Props> = async ({ params = {} }) => { | ||
const host = params.host as string | undefined; | ||
const slugArray = params.slug as string[] | undefined; | ||
const pathname = slugArray != null ? slugArray.join("/") : ""; | ||
const docs = await REGISTRY_SERVICE.docs.v2.read.getDocsForUrl({ | ||
url: process.env.NEXT_PUBLIC_DOCS_DOMAIN ?? buildUrl({ host: host ?? "", pathname }), | ||
}); | ||
|
||
if (!docs.ok) { | ||
return { props: { basePath: null } }; | ||
} | ||
|
||
const basePath = docs.body.baseUrl.basePath ?? null; | ||
|
||
return { props: { basePath } }; | ||
}; |
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