mirror of
https://github.com/lemeow125/StudE-Frontend.git
synced 2025-05-17 20:08:07 +08:00
Redirect to onboarding page if needed and added some missing functionality to login and logout button
This commit is contained in:
parent
a9acff39e4
commit
90e60250cd
4 changed files with 32 additions and 13 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue