This commit is contained in:
Alex Holliday committed 2025-06-19 12:11:43 +08:00
1 parent 8ea2053d37
commit d4b8eebd64
1 file changed
+4 -10
+4 -10
View File
@@ -432,9 +432,9 @@ class NetworkService {
throw err; throw err;
} }
async requestWebhook(platform, url, message) { async requestWebhook(type, url, body) {
try { try {
const response = await this.axios.post(url, message, { const response = await this.axios.post(url, body, {
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
}, },
@@ -444,7 +444,7 @@ class NetworkService {
type: "webhook", type: "webhook",
status: true, status: true,
code: response.status, code: response.status,
message: `Successfully sent ${platform} notification`, message: `Successfully sent ${type} notification`,
payload: response.data, payload: response.data,
}; };
} catch (error) { } catch (error) {
@@ -452,19 +452,13 @@ class NetworkService {
message: error.message, message: error.message,
service: this.SERVICE_NAME, service: this.SERVICE_NAME,
method: "requestWebhook", method: "requestWebhook",
url,
platform,
error: error.message,
statusCode: error.response?.status,
responseData: error.response?.data,
requestPayload: message,
}); });
return { return {
type: "webhook", type: "webhook",
status: false, status: false,
code: error.response?.status || this.NETWORK_ERROR, code: error.response?.status || this.NETWORK_ERROR,
message: `Failed to send ${platform} notification`, message: `Failed to send ${type} notification`,
payload: error.response?.data, payload: error.response?.data,
}; };
} }