introduce a running login chain

This commit is contained in:
Sven Czarnian
2022-11-03 02:01:18 +01:00
parent d0d31c723e
commit 914048fadf
5 changed files with 96 additions and 21 deletions

View File

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