golaert req fix and axios update for formdata
This commit is contained in:
parent
d44663c57c
commit
82dd9a7c16
File diff suppressed because it is too large
Load Diff
|
@ -63,7 +63,7 @@
|
|||
"dependencies": {
|
||||
"@louislam/sqlite3": "~15.0.6",
|
||||
"args-parser": "~1.3.0",
|
||||
"axios": "~0.26.1",
|
||||
"axios": "~0.27.0",
|
||||
"axios-ntlm": "^1.3.0",
|
||||
"badge-maker": "^3.3.1",
|
||||
"bcryptjs": "~2.4.3",
|
||||
|
|
|
@ -8,23 +8,26 @@ class GoAlert extends NotificationProvider {
|
|||
|
||||
async send(notification, msg, monitorJSON = null, heartbeatJSON = null) {
|
||||
let okMsg = "Sent Successfully.";
|
||||
let closeAction = "close";
|
||||
let parameters = {
|
||||
token: notification.goAlertToken,
|
||||
summary: msg,
|
||||
};
|
||||
// if (heartbeatJSON["status"] === UP) {
|
||||
// parameters["action"] = closeAction;
|
||||
// }
|
||||
try {
|
||||
await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming`, {
|
||||
params: parameters,
|
||||
});
|
||||
let closeAction = "close";
|
||||
let data = {
|
||||
summary: msg,
|
||||
};
|
||||
if (heartbeatJSON != null && heartbeatJSON["status"] === UP) {
|
||||
data["action"] = closeAction;
|
||||
}
|
||||
let headers = {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
};
|
||||
let config = {
|
||||
headers: headers
|
||||
};
|
||||
let resp = await axios.post(`${notification.goAlertBaseURL}/api/v2/generic/incoming?token=${notification.goAlertToken}`, data, config);
|
||||
console.log(resp);
|
||||
return okMsg;
|
||||
|
||||
} catch (error) {
|
||||
let msg = (error.response.data) ? error.response.data : "Error without response";
|
||||
console.log(error)
|
||||
throw new Error(msg);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue