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
- Invalid document structure: missing requ...
I just pick up my code that's working a week ago, and now I got this error: ``` code: 400, type: 'document_invalid_structure', response: { message: 'Inv...
- Error: User (role: guests) missing scope...
I want to send a verification code to the user and the given phone number and check it and create a session right after the user entered the secret. For me that...
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...