-
Notifications
You must be signed in to change notification settings - Fork 2
/
list.js
31 lines (31 loc) · 1.24 KB
/
list.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
var url = new URL('https://janus-dot-hackathon-313211.uc.r.appspot.com/applications')
var params = {email : localStorage.getItem("janus-email")}
url.search = new URLSearchParams(params).toString();
fetch(url).then(async function(res){
// alert(res.status);
if(res.status === 200) {
var data = await res.json();
console.log(data);
var tableBody = document.getElementById('table-body');
var index = 0;
data.forEach(application => {
var tr = document.createElement('tr');
tr.innerHTML = `
<th scope="row">${index+1}</th>
<td>${application.title}</td>
<td>${application.company}</td>
<td>${application.location}</td>
<td><a href="${application.link}">${application.link}</a></td>
<td>${application.status}</td>
<td><i class="fa fa-trash fa-2x" aria-hidden="true" style="color: red;"></i>
</td>
`;
tableBody.appendChild(tr);
index++;
});
}
})
// .then(function(resultdata){ alert( JSON.stringify( resultdata ) ) })
.catch(function(err){
alert("error "+err)
});