relogin, if the timestamp cannot be reached
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import React, { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
import React, { Dispatch, SetStateAction, useEffect, useState } from 'react';
|
||||||
import { System } from '../services';
|
import { Auth, System } from '../services';
|
||||||
import { BackendReturnStatus } from '../types';
|
import { BackendReturnStatus } from '../types';
|
||||||
|
|
||||||
const TimeContext = React.createContext<{
|
const TimeContext = React.createContext<{
|
||||||
@@ -14,7 +14,9 @@ export const TimeProvider = ({ children }: { children: any }) => {
|
|||||||
const estimateTimeOffset = async () => {
|
const estimateTimeOffset = async () => {
|
||||||
System.timestamp().then((response) => {
|
System.timestamp().then((response) => {
|
||||||
if (response.status === BackendReturnStatus.Unauthorized) {
|
if (response.status === BackendReturnStatus.Unauthorized) {
|
||||||
// TODO relogin
|
Auth.triggerLoginFlow();
|
||||||
|
// TODO reload user data in auth
|
||||||
|
// TODO store current URL and get back after login
|
||||||
} else if (response.status === BackendReturnStatus.Ok) {
|
} else if (response.status === BackendReturnStatus.Ok) {
|
||||||
// calculate the time offset (not accurate) between the server and the client to show "correct" times
|
// calculate the time offset (not accurate) between the server and the client to show "correct" times
|
||||||
const clientTimeUtc = new Date().getTime()
|
const clientTimeUtc = new Date().getTime()
|
||||||
|
|||||||
Reference in New Issue
Block a user