Currently, I am attempting to include a link that will direct users to the create page. However, when I tried clicking on the link, I encountered the following error:
TypeError: Cannot read properties of undefined (reading 'cookies')
The code for the link is as follows:
<Link href={link}>Add New Employee</Link>
This snippet of code is found in getInitialProps within _app.tsx:
MyApp.getInitialProps = async (context: any) => {
const {req, res, pathname} = context.ctx;
const {language, auth_key} = req.cookies;
return {
lang: language ?? 'ar',
token: auth_key ?? null,
}
};