Redirect to onboarding page if needed and added some missing functionality to login and logout button

This commit is contained in:
Keannu Christian Bernasol 2023-07-04 21:01:56 +08:00
parent a9acff39e4
commit 90e60250cd
4 changed files with 32 additions and 13 deletions

View file

@ -1,11 +1,7 @@
import * as React from "react";
import styles from "../../styles";
import { View, Text, ActivityIndicator } from "react-native";
import {
TokenRefresh,
UserInfo,
setAccessToken,
} from "../../components/Api/Api";
import { TokenRefresh, UserInfo } from "../../components/Api/Api";
import { useDispatch } from "react-redux";
import { colors } from "../../styles";
import { useEffect, useState } from "react";
@ -23,12 +19,12 @@ export default function Revalidation() {
TokenRefresh().then(async (response) => {
if (response[0]) {
await dispatch(setUser(await UserInfo()));
setTimeout(() => {
await setTimeout(() => {
navigation.navigate("Home");
}, 700);
} else {
setState("Session expired");
setTimeout(() => {
await setState("Session expired");
await setTimeout(() => {
navigation.navigate("Login");
}, 700);
}