// ============================== 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
- Auth not working
guys my appwrite auth isnt working? oauth works (Sign in with google n discord) i have 2 websites deployed where do i get help when i do sign in with email and ...
- Apple OAuth2 settings auto-disable every...
Hello, I'm on Appwrite 1.8.1 at the moment. I'm using on prod Apple Oauth and it keeps disabling itself every night. I don't know where to look for the solutio...
- 1.9.5 Migration problem
1.9.5 migration problem after run migration command only openruntimes-executor