
So i am trying to make a different layout for admins and regular users, and couldnt find a way to get the user role. I tried looking on the internet but so far i only found people addressing different roles thru permissions api. Is there any simpler way to just get the role? I know this sounds like a trivial question but thanks anyway 😄
try {
const currentAccount = await account.get();
if (!currentAccount) throw Error;
const currentUser = await databases.listDocuments(
databaseId,
userCollectionId,
[Query.equal('accountId', currentAccount.$id)]
)
console.log('account.get(): ', currentUser)
if (!currentUser) throw Error;
return currentUser.documents[0]
} catch (error) {
console.error(error);
}
}
}```
Recommended threads
- Email Verification Email
Hi everyone, I’m currently experiencing an issue with the email verification functionality. When I trigger the verification, the request returns a valid respon...
- Appwrite Cloud Custom Domains Issue
I’m trying to configure my custom domain api.kondri.lt (CNAME pointing to appwrite.network., also tried fra.cloud.appwrite.io with no luck ) but encountering a ...
- Persistent 401 Unauthorized on all authe...
Hello, I'm facing a critical 401 Unauthorized error on my admin panel app and have exhausted all debugging options. The Problem: When my React app on localhos...
