// ============================== 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
- User columns stuck on processing
Hi — on Appwrite Cloud (Free), Project ID 69d7dd8200098ed8560c, database mylestone-db. Attributes/columns are stuck in "processing" indefinitely across two coll...
- Custom API domain is unreachable
Earlier my custom api domain was working fine. Now it seems to be offline without a trace a few hours later. I didn't change anything, all the relevant DNS reco...
- "Invalid console fingerprint" when unpau...
I've tried logging out and logging back in, still can't figure out why this is happening.