
Trying to add a sign out button, using Expo, trying to end the session but after MANY attempts, i am unable to do so, export const returnSessions = async () => { return account.listSessions(); } export async function signOut() { try { // Delete all sessions for the currently authenticated user await account.deleteSessions(); console.log('All user sessions deleted successfully.'); } catch (error) { console.error('Error deleting sessions:', error.message); } }
const logout = async () => {
setIsLoading(true); // Show a loading state
try {
await signOut(); // Attempt to sign out
setUser(null); // Clear the user state
setIsLogged(false); // Update the logged state
router.replace("../sign-in"); // Redirect to sign-in page
} catch (error) {
console.error('Logout failed:', error.message); // Log the error message
} finally {
setIsLoading(false); // Hide the loading state regardless of success or failure
}
};
this is what i have so far. can someone please help 😢

FYI, it's best to wrap code in backticks to format a bit nicer. You can use 1 backtick for inline code (https://www.markdownguide.org/basic-syntax/#code) and 3 backticks for multiline code (https://www.markdownguide.org/extended-syntax/#syntax-highlighting).

what do you mean you're "unable to do so"? What's happening?

export async function signOut() { try { const session = await account.deleteSession("current");
return session;
} catch (error) { throw new Error(error); } Try this way.. I think you used chat gpt. Which might give you wrong code
Recommended threads
- After upgrading expo 52 to 53
Hello After upgrading my project from Expo SDK 52 to SDK 53, I encountered the following error when running the app: TurboModuleRegistry.getEnforcing(...): 'P...
- How can I use react-native-appwrite in a...
I'm building an app using React Native CLI (not Expo), and I want to add Google Sign-In authentication. However, when I try to use react-native-appwrite, it thr...
- Appwrite custom domain verification fail...
So I've left enough time for the records to propagate and I've tried adding in a subdomain for the appwrite endpoint so as not to cause a clash with two CNAME r...
