1 |
e75db9cd
|
Jan Pašek
|
|
2 |
6c9cb54a
|
Jan Pašek
|
// certificate listing app VUE instance
|
3 |
e75db9cd
|
Jan Pašek
|
var certificateListingApp = new Vue({
|
4 |
|
|
el: "#certificateListingPage",
|
5 |
|
|
data: {
|
6 |
6c9cb54a
|
Jan Pašek
|
// list of all certificates to be displayed in the list
|
7 |
6d850d19
|
Jan Pašek
|
certificates: [],
|
8 |
|
|
successMessage: ''
|
9 |
|
|
},
|
10 |
|
|
mounted: function () {
|
11 |
|
|
const params = window.location.search;
|
12 |
|
|
if (params !== "") {
|
13 |
|
|
const urlParams = new URLSearchParams(params);
|
14 |
|
|
if (urlParams.get("success") != null) this.successMessage = urlParams.get("success");
|
15 |
|
|
}
|
16 |
e75db9cd
|
Jan Pašek
|
}
|
17 |
|
|
});
|
18 |
|
|
|
19 |
6c9cb54a
|
Jan Pašek
|
// download a list of all available certificates and display them in the table
|
20 |
28787717
|
Jan Pašek
|
axios.get(API_URL + "certificates")
|
21 |
e75db9cd
|
Jan Pašek
|
.then(function (response) {
|
22 |
|
|
if (response.data["success"])
|
23 |
|
|
response.data["data"].forEach(item => certificateListingApp.certificates.push(item))
|
24 |
|
|
else
|
25 |
|
|
console.log("Error occured while loading certificate list") // TODO more action may be required
|
26 |
|
|
})
|
27 |
|
|
.catch(function (error) {
|
28 |
|
|
console.log(error);
|
29 |
6c9cb54a
|
Jan Pašek
|
});
|