Projekt

Obecné

Profil

Stáhnout (1.09 KB) Statistiky
| Větev: | Tag: | Revize:
1

    
2
    // certificate listing app VUE instance
3
    var certificateListingApp = new Vue({
4
        el: "#certificateListingPage",
5
        data: {
6
            // list of all certificates to be displayed in the list
7
            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
        }
17
    });
18

    
19
    // download a list of all available certificates and display them in the table
20
    axios.get(API_URL + "certificates")
21
        .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
        });
(8-8/10)