Redirect on Agent Profile for NGO and Volunteers#680
Conversation
nadavosa
left a comment
There was a problem hiding this comment.
Logic is correct and the server-side auth check is the right approach for the app router. One issue though: the redirect loses the language prefix.
redirect(`/dashboard/agents`);Since this page is under [lang], it should be:
const { id, lang } = await params;
// ...
redirect(`/${lang}/dashboard/agents`);Otherwise users hitting an agent profile URL in German (/de/dashboard/agents/123) get redirected to /dashboard/agents which would either 404 or land on the wrong language.
nadavosa
left a comment
There was a problem hiding this comment.
Logic is correct and the server-side auth check is the right approach for the app router. One issue though: the redirect loses the language prefix.
redirect(`/dashboard/agents`);Since this page is under [lang], it should be:
const { id, lang } = await params;
// ...
redirect(`/${lang}/dashboard/agents`);Otherwise users hitting an agent profile URL in German (/de/dashboard/agents/123) get redirected to /dashboard/agents which would either 404 or land on the wrong language.
|
thanks @nadavosa ! I'm going to have to argue with the AI I'm afraid. In the Adding the If you've experienced issues when manually testing it though, let me know |
Description
Adds a redirect on
/agent/[id]for users who aren'tADMINorCOORDINATORRelated Issues
Closes #576 , cooicides with PR 641 which adds unclickable links and restricted-list views
Changes
To reproduce:
AGENTorVOLUNTEER.../dashbaord/agents/1.../dashboard/agentsADMINorCOORDINATOR.../dashbaord/agents/1Screenshots / Demos
If UI-related, add before/after or GIFs.
Checklist