register address
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import AsyncStorage from '@react-native-async-storage/async-storage';
|
||||
import { router } from 'expo-router';
|
||||
import { createContext, useContext, useEffect, useState } from 'react';
|
||||
|
||||
type AuthContextType = {
|
||||
@@ -32,8 +31,7 @@ export function AuthProvider({ children }: { children: React.ReactNode }) {
|
||||
const logout = async () => {
|
||||
await AsyncStorage.removeItem('access_token');
|
||||
await AsyncStorage.removeItem('refresh_token');
|
||||
setIsAuthenticated(false);
|
||||
router.replace('/(auth)');
|
||||
setIsAuthenticated(false)
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -31,7 +31,10 @@ export const CustomHeader = ({
|
||||
<Image source={LogoText} style={{ width: 160, height: 30, objectFit: 'contain' }} />
|
||||
</View>
|
||||
{logoutbtn && (
|
||||
<TouchableOpacity onPress={logout}>
|
||||
<TouchableOpacity onPress={async () => {
|
||||
await logout();
|
||||
router.replace('/(auth)');
|
||||
}}>
|
||||
<LogOut color={'red'} />
|
||||
</TouchableOpacity>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user