-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(i18n): implement i18n in pages and accommodate/use server side 4…
…04 redirects - Make sure a string is sent to API instead of undefined - Make error page look proper
- Loading branch information
1 parent
15baffd
commit 17bdfca
Showing
10 changed files
with
84 additions
and
27 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
import { PageAnimation } from '@components/UI' | ||
import * as MUI from '@material-ui/core' | ||
import getSanityConfig from '@util/api/calls/getSanityConfig' | ||
import { AnimatePresence } from 'framer-motion' | ||
import { NextPage } from 'next' | ||
import { PageProps } from 'PageProps' | ||
|
||
interface IErrorProps { | ||
statusCode: string | undefined | ||
interface IErrorProps extends PageProps { | ||
statusCode: number | undefined | ||
} | ||
|
||
const Error: React.FC<IErrorProps> = (props) => { | ||
const Error: NextPage<IErrorProps> = (props) => { | ||
const { statusCode } = props | ||
|
||
return ( | ||
<PageAnimation> | ||
<MUI.Typography> | ||
{statusCode | ||
? `An error occurred on the server: ${statusCode}` | ||
: `An error occurred on the client`} | ||
</MUI.Typography> | ||
</PageAnimation> | ||
<AnimatePresence> | ||
<PageAnimation> | ||
<MUI.Typography> | ||
{statusCode | ||
? `An error occurred on the server: ${statusCode}` | ||
: `An error occurred on the client`} | ||
</MUI.Typography> | ||
</PageAnimation> | ||
</AnimatePresence> | ||
) | ||
} | ||
|
||
Error.getInitialProps = async (ctx) => { | ||
const config = await getSanityConfig() | ||
// console.log(ctx) | ||
|
||
return { | ||
...config, | ||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment | ||
statusCode: ctx.res?.statusCode | ||
} | ||
} | ||
|
||
export default Error |
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 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