add network request for getting status page by url, update create status page method
This commit is contained in:
1 parent
b829bd4549
commit
14ce47d97b
1 file changed
+26
-12
@@ -974,19 +974,31 @@ class NetworkService {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getStatusPageByUrl(config) {
|
||||||
|
const { authToken, url } = config;
|
||||||
|
return this.axiosInstance.get(`/status-page/${url}`, {
|
||||||
|
headers: {
|
||||||
|
Authorization: `Bearer ${authToken}`,
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
async createStatusPage(config) {
|
async createStatusPage(config) {
|
||||||
const { authToken, user, form, isCreate } = config;
|
const { authToken, user, form, isCreate } = config;
|
||||||
const fd = new FormData();
|
const fd = new FormData();
|
||||||
fd.append("isPublished", form.isPublished);
|
form.isPublished && fd.append("isPublished", form.isPublished);
|
||||||
fd.append("companyName", form.companyName);
|
form.companyName && fd.append("companyName", form.companyName);
|
||||||
fd.append("url", form.url);
|
form.url && fd.append("url", form.url);
|
||||||
fd.append("timezone", form.timezone);
|
form.timezone && fd.append("timezone", form.timezone);
|
||||||
fd.append("color", form.color);
|
form.color && fd.append("color", form.color);
|
||||||
fd.append("showCharts", form.showCharts);
|
form.showCharts && fd.append("showCharts", form.showCharts);
|
||||||
fd.append("showUptimePercentage", form.showUptimePercentage);
|
form.showUptimePercentage &&
|
||||||
form.monitors.forEach((monitorId) => {
|
fd.append("showUptimePercentage", form.showUptimePercentage);
|
||||||
fd.append("monitors[]", monitorId);
|
form.monitors &&
|
||||||
});
|
form.monitors.forEach((monitorId) => {
|
||||||
|
fd.append("monitors[]", monitorId);
|
||||||
|
});
|
||||||
if (form?.logo?.src && form?.logo?.src !== "") {
|
if (form?.logo?.src && form?.logo?.src !== "") {
|
||||||
const imageResult = await axios.get(form.logo.src, {
|
const imageResult = await axios.get(form.logo.src, {
|
||||||
responseType: "blob",
|
responseType: "blob",
|
||||||
@@ -1013,8 +1025,10 @@ class NetworkService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async deleteStatusPage(config) {
|
async deleteStatusPage(config) {
|
||||||
const { authToken } = config;
|
const { authToken, url } = config;
|
||||||
return this.axiosInstance.delete(`/status-page`, {
|
const encodedUrl = encodeURIComponent(url);
|
||||||
|
|
||||||
|
return this.axiosInstance.delete(`/status-page/${encodedUrl}`, {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `Bearer ${authToken}`,
|
Authorization: `Bearer ${authToken}`,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user