I am building a webapp with:
Frontend: NextJS14 App Router, React in Typescript
Backend: ExpressJS, MongoDB.
For a protected route, server-side rendered in NextJS, let's say under src/app/account/page.tsx
Let's say this page, will have this component:
`
import React from 'react';
import { fetchEligibility() } from '../server-functions/fetchEligibility';
async function Account() {
const eligibile = await fetchEligibility();
if (eligibile){
return <EligibleComponent />
} else {
return <UneligibleComponent />
}
}
export default Account`
Lets say the fetchEligibility() determines that this session is eligible to access the page, but has outdated cookies and wants to update them, so it want to set some cookies on the client-side, since this is a server-side function being executed in NextJS, how can we achieve this?