Add thunks for adding and removing demo monitors

This commit is contained in:
Alex Holliday
2024-09-11 12:03:13 +08:00
parent 65cc70cbdd
commit c35157ffb4
4 changed files with 150 additions and 6 deletions
+40
View File
@@ -274,6 +274,46 @@ class NetworkService {
);
}
/**
* ************************************
* Adds demo monitors
* ************************************
*
* @async
* @param {string} authToken - The authorization token to be used in the request header.
* @returns {Promise<AxiosResponse>} The response from the axios POST request.
*/
async addDemoMonitors(authToken) {
return this.axiosInstance.post(
`/monitors/demo`,
{},
{
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
}
);
}
/**
* ************************************
* Deletes all monitors for a team by team ID
* ************************************
*
* @async
* @param {string} authToken - The authorization token to be used in the request header.
* @returns {Promise<AxiosResponse>} The response from the axios DELETE request.
*/
async deleteAllMonitors(authToken) {
return this.axiosInstance.delete(`/monitors/`, {
headers: {
Authorization: `Bearer ${authToken}`,
"Content-Type": "application/json",
},
});
}
/**
* ************************************
* Gets the certificate expiry for a monitor