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
- document.update
Invalid relationship value! The data I'm passing is not null and all the rest I'm just updating the document and not the relationship
- Error while updating string attribute on...
Hello! I want to update some string attributes directly in Appwrite Cloud, but I keep getting the message: [AppwriteException: Invalid relationship value. Must ...
- rate limit exceeded
Hello, Im testing my app and it keeps rate limiting every so often. I see in docs this is per hour, is there anyway to remove or change the rate limit for testi...