Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 37a8e8ec

Přidáno uživatelem Jan Pašek před téměř 4 roky(ů)

Re #8583 - index.js uses await

Zobrazit rozdíly:

static/js/index.js
10 10
        certificates: [],
11 11
        successMessage: ''
12 12
    },
13
    mounted: function () {
13
    mounted: async function () {
14 14
        const params = window.location.search;
15 15
        if (params !== "") {
16 16
            const urlParams = new URLSearchParams(params);
......
29 29
        }
30 30

  
31 31
        // download a list of all available certificates and display them in the table
32
        axios.get(API_URL + "certificates")
33
            .then(function (response) {
34
                if (response.data["success"]) {
35
                    response.data["data"].forEach(item => certificateListingApp.certificates.push(item))
36
                }
37
                certificateListingApp.loading = false;
38
            })
39
            .catch(function (error) {
40
                console.log(error);
41
                certificateListingApp.loading = false;
42
            });
32
        try {
33
            const response = await axios.get(API_URL + "certificates");
34
            if (response.data["success"]) {
35
                response.data["data"].forEach(item => certificateListingApp.certificates.push(item))
36
            }
37
            certificateListingApp.loading = false;
38
        } catch (error) {
39
            console.log(error);
40
            certificateListingApp.loading = false;
41
        }
43 42
    }
44 43
});

Také k dispozici: Unified diff