
I want to redirect admin to admin page and others to user page, how can I do so?
TL;DR
Solution:
To redirect admins to the admin page and others to the user page based on their labels, you can modify the code as follows:
```ts
try {
const account = account.get();
if (account.labels.includes('admin')) {
redirect('admin');
} else {
redirect('dashboard');
}
} catch (err) {
redirect('sign-in');
}
```
After the user is authenticated you can check it's labels to see if they're an admin and if they are redirect them to whatever page you want.

you can do something like
TypeScript
// This is just something I created quickly so it probably won't work as is lol
try {
const account = account.get();
if(account.labels.includes('admin')) {
redirect('admin');
} else {
redirect('dashboard');
}
} catch (err) {
redirect('sign-in');
}
Recommended threads
- Web SDK chunk upload to Storage without ...
As discussed in this older thread (https://discord.com/channels/564160730845151244/1216821517749321808), the Read permission for Any needs to be enabled in orde...
- Issue while signing up.
Hey, I’m running into an issue right after the setup. I followed the setup instructions and ran `docker compose up -d`, and while the local server seems to be r...
- Cannot resolve server
Greetings! Is this a known issue at this time? Cloudflare reports likewise. Please advise, thank you!
