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 😢
Recommended threads
- How do i make an index for a relation
Im trying to have a feature in my app where you search a video by its user but when I try to implement it, I get the error that "creator" needs its own fulltex...
- 401 (Unauthorized) User (role: guests) m...
This error goes away after login but appears again after logout
- Does Appwrite Automatically Add Existing...
When a user invites a new team member via mail, and the person being invited already has an appwrite account with that mail, does appwrite automatically recogni...