forked from chenkie/orbit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAuthDebugger.js
38 lines (35 loc) · 987 Bytes
/
AuthDebugger.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React, { useContext } from 'react';
import { AuthContext } from './../context/AuthContext';
const AuthStateItem = ({ title, value }) => (
<div className="text-sm">
<p className="font-bold mb-2">{title}</p>
<pre className="whitespace-pre-wrap bg-gray-100 p-2 rounded">
<code className="break-all">{value}</code>
</pre>
</div>
);
const AuthDebugger = () => {
const authContext = useContext(AuthContext);
const {
token,
expiresAt,
userInfo
} = authContext.authState;
return (
<section className="rounded-lg shadow bg-white p-4">
<div className="mb-2">
<AuthStateItem title="Token" value={token} />
</div>
<div className="mb-2">
<AuthStateItem title="Expiry" value={expiresAt} />
</div>
<div className="mb-2">
<AuthStateItem
title="User Info"
value={JSON.stringify(userInfo, null, 2)}
/>
</div>
</section>
);
};
export default AuthDebugger;