Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 28787717

Přidáno uživatelem Jan Pašek před asi 4 roky(ů)

Re #8475 - Created constants.js for Rest API endpoint definitions

Zobrazit rozdíly:

static/js/components.js
11 11
                    "   <div v-if='certificate.usage.SSL'>SSL/TLS</div>" +
12 12
                    "</td>"+
13 13
                    "<td class='align-middle'><button v-on:click='onCertificateDownload()'>Download certificate</button></td>"+
14
                    "<td class='align-middle'><button>Download chain of trust</button></td>"+
15
                    "<td class='align-middle'><button>Download chain root</button></td>"+
14
                    "<td class='align-middle'><button v-on:click='onCertificateChainDownload()'>Download chain of trust</button></td>"+
15
                    "<td class='align-middle'><button v-on:click='onCertificateRootDownload()'>Download chain root</button></td>"+
16 16
                "</tr>",
17 17
        methods: {
18 18
            onCertificateDownload: function () {
19 19
                var id = this.certificate.id;
20
                axios.get("https://virtserver.swaggerhub.com/janpasek97/X509_management/1.0.0/api/certificates/" + id)
20
                axios.get(API_URL + "certificates/" + id)
21 21
                    .then(function (response) {
22 22
                        if(response.data["success"]) {
23 23
                            download(id + ".crt", response.data["data"])
......
28 28
                    .catch(function (error) {
29 29
                        console.log(error);
30 30
                    });
31
            },
32
            onCertificateChainDownload: function () {
33
                var id = this.certificate.id;
34
                axios.get(API_URL + "certificates/" + id + "/chain")
35
                    .then(function (response) {
36
                        if(response.data["success"]) {
37
                            download(id + "_chain.crt", response.data["data"])
38
                        }
39
                        else
40
                            console.log("Error occurred while downloading the certificate's chain of trust") // TODO more action may be required
41
                    })
42
                    .catch(function (error) {
43
                        console.log(error);
44
                    });
45
            },
46
            onCertificateRootDownload: function () {
47
                var id = this.certificate.id;
48
                axios.get(API_URL + "certificates/" + id + "/root")
49
                    .then(function (response) {
50
                        if(response.data["success"]) {
51
                            download(id + "_root.crt", response.data["data"])
52
                        }
53
                        else
54
                            console.log("Error occurred while downloading the certificate's root CA") // TODO more action may be required
55
                    })
56
                    .catch(function (error) {
57
                        console.log(error);
58
                    });
31 59
            }
32 60
        }
33 61
    });

Také k dispozici: Unified diff