aswi2021jmsd-gitlab4/static/js/create_certificate.js @ b556270c
1 |
var createCertificateApp = new Vue({ |
---|---|
2 |
el: "#create-certificate-content", |
3 |
data: { |
4 |
authorities: [{id: 5, CN: "Test"}], |
5 |
selectedCA: null, |
6 |
selectedCAData: { |
7 |
CN: "", |
8 |
C: "", |
9 |
L: "", |
10 |
ST: "", |
11 |
O: "", |
12 |
OU: "", |
13 |
emailAddress: "" |
14 |
}
|
15 |
},
|
16 |
watch: { |
17 |
selectedCA: function (val, oldVal) { |
18 |
if (val === "null" || val == null) { |
19 |
createCertificateApp.selectedCAData = { |
20 |
CN: "", |
21 |
C: "", |
22 |
L: "", |
23 |
ST: "", |
24 |
O: "", |
25 |
OU: "", |
26 |
emailAddress: "" |
27 |
};
|
28 |
}
|
29 |
else { |
30 |
axios.get(API_URL + "certificates/" + val + "/details") |
31 |
.then(function (response) { |
32 |
if (response.data["success"]) { |
33 |
createCertificateApp.selectedCAData = response.data["data"]["subject"]; |
34 |
}
|
35 |
else
|
36 |
console.log("Error occurred while fetching CA details"); |
37 |
})
|
38 |
.catch(function (error) { |
39 |
console.log(error); |
40 |
});
|
41 |
}
|
42 |
}
|
43 |
}
|
44 |
});
|
45 |
|
46 |
axios.get(API_URL+"certificates", { |
47 |
params: { |
48 |
filtering: { |
49 |
CA: true |
50 |
}
|
51 |
}
|
52 |
})
|
53 |
.then(function (response) { |
54 |
if (response.data["success"]) { |
55 |
createCertificateApp.authorities = response.data["data"]; |
56 |
}
|
57 |
else
|
58 |
console.log("Error occurred while fetching list of available certificate authorities"); |
59 |
})
|
60 |
.catch(function (error) { |
61 |
console.log(error); |
62 |
});
|