use the new timestamp endpoint for tests

This commit is contained in:
Sven Czarnian
2022-11-03 23:38:10 +01:00
parent 4bb0a44b7e
commit 4506e2f4a1

View File

@@ -1,14 +1,20 @@
import React, { useState } from 'react'; import React, { useEffect, useState } from 'react';
import axios from 'axios'; import axios from 'axios';
export const Overview: React.FC = () => { export const Overview: React.FC = () => {
const [msg, setMsg] = useState('LOADING'); const [msg, setMsg] = useState('LOADING');
axios.get('http://localhost:3000/auth/user', { useEffect(() => {
const interval = setInterval(() => {
axios.get('http://localhost:3000/system/timestamp', {
headers: { headers: {
Authorization: `Bearer ${sessionStorage.getItem('token')}`, Authorization: `Bearer ${sessionStorage.getItem('token')}`,
}, }
}).then((data) => setMsg(data.data)).catch(() => setMsg('FAILED')); }).then((response) => setMsg(new Date(response.data).toISOString()));
}, 5000);
return () => clearInterval(interval);
}, []);
return <>OVERVIEW {msg}</>; return <>OVERVIEW {msg}</>;
}; };