-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
94 lines (81 loc) · 2.71 KB
/
Copy pathindex.html
File metadata and controls
94 lines (81 loc) · 2.71 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-KK94CHFLLe+nY2dmCWGMq91rCGa5gtU4mk92HdvYe+M/SXH301p5ILy+dN9+nJOZ" crossorigin="anonymous">
<title>Dashboard</title>
</head>
<body>
<section class="popinsmain">
<section class="col-sm-12 contentsection">
<div class="container" style="text-align: center;">
<div class="col-sm-12 neworder">
<h2>All Users</h2>
</div>
<div class="col-sm-12 profile">
<button onclick="window.sessionStorage.clear(); window.location='login.html'" >Logout</button>
</div>
</div>
<div class="tab-content" id="myTabContent">
<div class="tab-pane fade show active" id="dashboard" role="tabpanel" aria-labelledby="dashboard-tab">
<div class="container-fluid table">
<!-- <table>
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">First Name</th>
<th scope="col">Last Name</th>
<th scope="col">User</th>
<th scope="col">Email</th>
</tr>
</thead>
<tbody id="print">
</tbody>
</table> -->
<div class="container" style="border:2%">
<table class="table table-hover">
<thead>
<tr>
<th scope="col">ID</th>
<th scope="col">First Name</th>
<th scope="col">User</th>
<th scope="col">Email</th>
</tr>
</thead>
<tbody id="print">
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
</section>
<script type="text/javascript">
const api_url = "https://reqres.in/api/users?per_page=12";
getUser();
async function getUser() {
const token = window.sessionStorage.getItem("token");
if (!token) {
window.location="login.html";
return false;
}
// Making an API call (request)
// and getting the response back
const response = await fetch(api_url);
// Parsing it to JSON format
const result = await response.json();
const data = result.data;
console.log(data);
data.map(nr=>{document.getElementById("print").innerHTML = document.getElementById("print").innerHTML+`<br>`+ `<tr>
<td>#`+nr.id+`</td>
<td>`+nr.first_name+`</td>
<td>`+nr.last_name+` </td>
<td><img src="`+nr.avatar+`"></td>
<td>`+nr.email+`</td>
</tr>`});
}
</script>
</body>
</html>