async function isAuthenticated(req, res) {
  try {
    const response = await client.get('/api/silentLogin', {
      headers: {
        cookie: req.headers.cookie,
      },
    });
    return response.data;
  } catch (error) {
    console.error(error.message);
    return null;
  }
}
/**
 * Checks if a user is authenticated or not.
 *  req: The request from getServerSideProps
 *  res: The response from getServerSideProps
 */
Checks if a user is authenticated or not.
req: The request from getServerSideProps
res: The response from getServerSideProps
Checks if a user is authenticated or not . req : The request from getServerSideProps res : The response from getServerSideProps
async function isAuthenticated(req, res) {
  try {
    const response = await client.get('/api/silentLogin', {
      headers: {
        cookie: req.headers.cookie,
      },
    });
    return response.data;
  } catch (error) {
    console.error(error.message);
    return null;
  }
}
async function isAuthenticated ( req , res ) { try { const response = await client . get ( '/api/silentLogin' , { headers : { cookie : req . headers . cookie , } , } ) ; return response . data ; } catch ( error ) { console . error ( error . message ) ; return null ; } }
Checks if a user is authenticated or not.
Checks if a user is authenticated or not .