
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
- my database attribute stuck in processin...
when i created attributes in collection 3 of those attributes become "processing", and they are not updating, the worst thing is that i cant even delete them s...
- Is Quick Start for function creation wor...
I am trying to create a Node.js function using the Quick Start feature. It fails and tells me that it could not locate the package.json file. Isn't Quick Start ...
- Forever Processing Issue
I encountered an issue when creating attributes in the collections . if you create an attribute of type string for example and choose a size of 200 or 250 or a...
