From f14a798b2cc1d4c37b17ff8b615001b7720f5b18 Mon Sep 17 00:00:00 2001 From: DeeJayPee Date: Tue, 5 Oct 2021 19:43:04 +0200 Subject: [PATCH] Fix indentation + typo --- server/notification-providers/octopush.js | 66 +++++++++++------------ src/components/NotificationDialog.vue | 18 +++---- 2 files changed, 41 insertions(+), 43 deletions(-) diff --git a/server/notification-providers/octopush.js b/server/notification-providers/octopush.js index 228e1b2a..9d77d50c 100644 --- a/server/notification-providers/octopush.js +++ b/server/notification-providers/octopush.js @@ -9,52 +9,50 @@ class Octopush extends NotificationProvider { let okMsg = "Sent Successfully. "; try { - // Default - V2 - if (notification.octopushVersion == 2 || !notification.octopushVersion) - { - let config = { + // Default - V2 + if (notification.octopushVersion == 2 || !notification.octopushVersion) { + let config = { headers: { - "api-key": notification.octopushAPIKey, - "api-login": notification.octopushLogin, - "cache-control": "no-cache" + "api-key": notification.octopushAPIKey, + "api-login": notification.octopushLogin, + "cache-control": "no-cache" } - }; - let data = { + }; + let data = { "recipients": [ - { + { "phone_number": notification.octopushPhoneNumber - } + } ], //octopush not supporting non ascii char "text": msg.replace(/[^\x00-\x7F]/g, ""), "type": notification.octopushSMSType, "purpose": "alert", "sender": notification.octopushSenderName - }; - await axios.post("https://api.octopush.com/v1/public/sms-campaign/send", data, config) - } - else if (notification.octopushVersion == 1) - { - let data = { + }; + await axios.post("https://api.octopush.com/v1/public/sms-campaign/send", data, config) + } else if (notification.octopushVersion == 1) { + let data = { "user_login": notification.octopushDMLogin, - "api_key": notification.octopushDMAPIKey, - "sms_recipients" : notification.octopushDMPhoneNumber, - "sms_sender": notification.octopushDMSenderName, - "sms_type": (notification.octopushDMSMSType == 'sms_premium')?'FR':'XXX', - "transactional": '1', - //octopush not supporting non ascii char - "sms_text": msg.replace(/[^\x00-\x7F]/g, ""), - }; + "api_key": notification.octopushDMAPIKey, + "sms_recipients": notification.octopushDMPhoneNumber, + "sms_sender": notification.octopushDMSenderName, + "sms_type": (notification.octopushDMSMSType == "sms_premium") ? "FR" : "XXX", + "transactional": "1", + //octopush not supporting non ascii char + "sms_text": msg.replace(/[^\x00-\x7F]/g, ""), + }; - let config = { - headers: { - "cache-control": "no-cache" - }, - params: data - }; - await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config) - } else - throw new Error('Unknown Octopush version !'); + let config = { + headers: { + "cache-control": "no-cache" + }, + params: data + }; + await axios.post("https://www.octopush-dm.com/api/sms/json", {}, config) + } else { + throw new Error("Unknown Octopush version!"); + } return okMsg; } catch (error) { diff --git a/src/components/NotificationDialog.vue b/src/components/NotificationDialog.vue index 10765600..f988ee20 100644 --- a/src/components/NotificationDialog.vue +++ b/src/components/NotificationDialog.vue @@ -244,16 +244,16 @@