aboutsummaryrefslogtreecommitdiff
path: root/vnext/server/http.js
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/server/http.js')
-rw-r--r--vnext/server/http.js34
1 files changed, 16 insertions, 18 deletions
diff --git a/vnext/server/http.js b/vnext/server/http.js
index 0ffa8bfe..a90afef3 100644
--- a/vnext/server/http.js
+++ b/vnext/server/http.js
@@ -1,7 +1,7 @@
-import axios from 'axios';
-import config from 'config';
-import debug from 'debug';
-var log = debug('http');
+import axios from 'axios'
+import config from 'config'
+import debug from 'debug'
+var log = debug('http')
/**
@@ -10,7 +10,6 @@ var log = debug('http');
*/
/**
* fetch message subscribers
- *
* @param {URLSearchParams} params - request params
* @returns {Promise<import('../client').SecureUser[]>} subscribers list
*/
@@ -18,26 +17,25 @@ export function subscribers(params) {
return new Promise((resolve, reject) => {
client.get(`/notifications?${params.toString()}`)
.then(response => {
- log(`CODE: ${response.status}`);
- resolve(response.data);
+ log(`CODE: ${response.status}`)
+ resolve(response.data)
})
- .catch(reason => { reject(reason); });
- });
+ .catch(reason => { reject(reason) })
+ })
}
/**
* delete invalid tokens
- *
* @param {import('../client').Token[]} tokens tokens
*/
export const deleteSubscribers = async (tokens) => {
- const response = await client.post('/notifications/delete', tokens);
- return response.data;
-};
+ const response = await client.post('/notifications/delete', tokens)
+ return response.data
+}
-const baseURL = config.get('service.baseURL') + '/api';
-const user = config.get('service.user') || process.env.JUICK_SERVICE_USER;
-const password = config.get('service.password') || process.env.JUICK_SERVICE_PASSWORD;
+const baseURL = config.get('service.baseURL') + '/api'
+const user = config.get('service.user') || process.env.JUICK_SERVICE_USER
+const password = config.get('service.password') || process.env.JUICK_SERVICE_PASSWORD
/** @type { import('axios').AxiosInstance } */
let client = axios.create({
@@ -45,5 +43,5 @@ let client = axios.create({
headers: user ? {
'Authorization': 'Basic ' + Buffer.from(user + ':' + password).toString('base64')
} : {}
-});
-log(`HTTP client initialized with base URL ${baseURL} ${ user? `and ${user} user` : ''}`);
+})
+log(`HTTP client initialized with base URL ${baseURL} ${ user? `and ${user} user` : ''}`)