// ============================== GET ACCOUNT export async function getAccount() { try { const currentAccount = await account.get(); console.log(currentAccount);
return currentAccount;
} catch (error) { console.log(error); // error here } }
// ============================== GET USER export async function getCurrentUser() { try { const currentAccount = await getAccount();
if (!currentAccount) throw Error;
const currentUser = await databases.listDocuments(
config.databaseId!,
config.userCollectionId!,
[Query.equal("userId", currentAccount.$id)]
);
if (!currentUser) throw Error;
return currentUser.documents[0];
} catch (error) { console.log(error); return null; } }
Recommended threads
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- > AppwriteException: The requested servi...
When trying to read or write from my database I get the following error: > AppwriteException: The requested service is disabled. You can enable the service from...
- Courtesy limit reset for non-profit migr...
Hi Team! I'm the architect for a 501(c)(3) non-profit project (Aaria's Blue Elephant) and we just hit our Free plan Database Read limit (currently at 164%). Th...