mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 04:53:30 +01:00
fix: return 404 if a fetch error or no data is returned
This commit is contained in:
@@ -133,7 +133,7 @@ export function DocContainer({
|
|||||||
{(kind === 'Class' || kind === 'Interface') && (methods?.length || properties?.length) ? (
|
{(kind === 'Class' || kind === 'Interface') && (methods?.length || properties?.length) ? (
|
||||||
<MediaQuery smallerThan="lg" styles={{ display: 'none' }}>
|
<MediaQuery smallerThan="lg" styles={{ display: 'none' }}>
|
||||||
<Aside hiddenBreakpoint="lg" width={{ lg: 250 }} withBorder>
|
<Aside hiddenBreakpoint="lg" width={{ lg: 250 }} withBorder>
|
||||||
<ScrollArea p="xs">
|
<ScrollArea p="xs" offsetScrollbars>
|
||||||
<TableOfContentItems properties={properties ?? []} methods={methods ?? []}></TableOfContentItems>
|
<TableOfContentItems properties={properties ?? []} methods={methods ?? []}></TableOfContentItems>
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</Aside>
|
</Aside>
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ export function ParameterTable({ data }: { data: ParameterDocumentation[] }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box>
|
<Box>
|
||||||
<ScrollArea type="auto">
|
<ScrollArea offsetScrollbars>
|
||||||
<Table columns={['Name', 'Type', 'Optional', 'Description']} rows={rows} columnStyles={columnStyles} />
|
<Table columns={['Name', 'Type', 'Optional', 'Description']} rows={rows} columnStyles={columnStyles} />
|
||||||
</ScrollArea>
|
</ScrollArea>
|
||||||
</Box>
|
</Box>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export function TypeParamTable({ data }: { data: TypeParameterData[] }) {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ overflowX: 'auto' }}>
|
<Box sx={{ overflowX: 'auto' }}>
|
||||||
<ScrollArea type="auto">
|
<ScrollArea offsetScrollbars>
|
||||||
<Table
|
<Table
|
||||||
columns={['Name', 'Constraints', 'Optional', 'Default', 'Description']}
|
columns={['Name', 'Constraints', 'Optional', 'Default', 'Description']}
|
||||||
rows={rows}
|
rows={rows}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
|
|||||||
} catch {
|
} catch {
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
error: 'FetchError',
|
notFound: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
||||||
const data: string[] = await res.json();
|
const data: string[] = await res.json();
|
||||||
|
|
||||||
|
if (!data.length) {
|
||||||
|
return {
|
||||||
|
notFound: true,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
packageName,
|
packageName,
|
||||||
@@ -37,10 +43,10 @@ export const getStaticProps: GetStaticProps = async ({ params }) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch {
|
||||||
return {
|
return {
|
||||||
props: {
|
props: {
|
||||||
error: 'FetchError',
|
notFound: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user