blob: bcab092a3875df7d78f17efe745fbf94b86bfc06 (
plain)
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
39
40
41
42
43
44
45
46
47
|
import { useState, useEffect } from 'react';
import Axios from 'axios';
import styles from '../styles/Dashboard.module.css';
// import { accessAPI } from '../helpers/api';
function Dashboard() {
// Get the links from the API
const [links, setLinks] = useState([]);
useEffect(() => {
Axios.get('/api/links')
.then((res) => {
setLinks(res.data);
})
.catch((err) => {
console.log(err);
});
}, []);
return (
<div id={styles.container}>
<table>
<thead>
<tr style={{ border: '2px solid #ccc' }}>
<th>Link</th>
<th>Visits</th>
<th>Redirect</th>
<th>Expire Date</th>
</tr>
</thead>
<tbody>
{/* {links.map((link: any) => (
<tr key={link.id}>
<td>{link.url}</td>
<td>{link.visits}</td>
<td>{link.redirect}</td>
<td>{link.expire_date}</td>
</tr>
))} */}
</tbody>
</table>
</div>
)
}
export default Dashboard;
|