Tabbar some agora com logout

This commit is contained in:
Matheus Albino Brunhara
2022-05-28 16:49:47 -05:00
parent c9f86fd337
commit 4edea7330a
2 changed files with 6 additions and 20 deletions

View File

@@ -40,8 +40,6 @@ import { search, home, person } from 'ionicons/icons';
import { useState, useContext, useEffect } from 'react';
import React from 'react';
import sessionsService from './services/functions/sessionsService'
setupIonicReact();
const routes = (
@@ -67,27 +65,12 @@ const user: IUserManager = {
export const UserContext = React.createContext<IUserManager>(user);
const IonicApp: React.FC = () => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
const user = useContext(UserContext);
user.setIsLoggedIn = setIsLoggedIn;
useEffect(() => {
const verifyAuthenticatedUser = async () => {
const refreshSessionRes = await sessionsService.refreshSession()
if (refreshSessionRes.error) {
return
}
if (refreshSessionRes.userId) {
setIsLoggedIn(true)
}
}
verifyAuthenticatedUser()
})
return(
<IonApp>
<IonReactRouter>