diff --git a/server/notification-providers/wpush.js b/server/notification-providers/wpush.js index 9b60365d..21fd37f0 100644 --- a/server/notification-providers/wpush.js +++ b/server/notification-providers/wpush.js @@ -12,14 +12,15 @@ class WPush extends NotificationProvider { const okMsg = "Sent Successfully."; try { - const ret = await axios.post("https://api.wpush.cn/api/v1/send", { + const context = { "title": this.checkStatus(heartbeatJSON, monitorJSON), "content": msg, "apikey": notification.wpushAPIkey, "channel": notification.wpushChannel - }); - if (ret.data.code !== 0) { - return ret.data.message; + }; + const result = await axios.post("https://api.wpush.cn/api/v1/send", context); + if (result.data.code !== 0) { + throw response.data.message; } return okMsg;