introduce a running login chain
This commit is contained in:
14
src/components/overview.tsx
Normal file
14
src/components/overview.tsx
Normal 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}</>;
|
||||
};
|
||||
Reference in New Issue
Block a user