Projekt

Obecné

Profil

Stáhnout (1.6 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
                // the following code is necessary to dismiss the alert when the page is reloaded
17
                const nextURL = '/static/index.html';
18
                const nextTitle = 'X.509 Certificate Management';
19
                const nextState = { additionalInformation: 'Updated the URL with JS' };
20

    
21
                // This will create a new entry in the browser's history, without reloading
22
                window.history.pushState(nextState, nextTitle, nextURL);
23

    
24
                // This will replace the current entry in the browser's history, without reloading
25
                window.history.replaceState(nextState, nextTitle, nextURL);
26
            }
27
        }
28
    });
29

    
30
    // download a list of all available certificates and display them in the table
31
    axios.get(API_URL + "certificates")
32
        .then(function (response) {
33
            if (response.data["success"])
34
                response.data["data"].forEach(item => certificateListingApp.certificates.push(item))
35
        })
36
        .catch(function (error) {
37
            console.log(error);
38
        });
(9-9/11)