From e4cdd091b4d367650d4b6f341a0f18628f2953a2 Mon Sep 17 00:00:00 2001 From: Adhidarma Hadiwinoto <me@adhisimon.org> Date: Tue, 10 Dec 2019 15:07:05 +0700 Subject: [PATCH] ESLINTED --- lib/webadmin/router/config.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/webadmin/router/config.js b/lib/webadmin/router/config.js index 1eaa1b0..9d7688b 100644 --- a/lib/webadmin/router/config.js +++ b/lib/webadmin/router/config.js @@ -79,9 +79,15 @@ async function modemAdd(req, res) { name: (req.body.name || '').trim(), imsi: (req.body.imsi || '').trim(), outgoing: !!req.body.outgoing, - prefix: (req.body.prefix || '').split(/[, ]+/).map((val) => val.trim().replace(/^0/, '62')).filter((row) => row), + prefix: (req.body.prefix || '').split(/[, ]+/) + .map((val) => val.trim().replace(/^0/, '62')) + .filter((row) => row), }; - const index = config.modems.find((item) => item.name.toUpperCase() === modem.name.toUpperCase()); + + const index = config.modems.find( + (item) => item.name.toUpperCase() === modem.name.toUpperCase(), + ); + if (index >= 0) { res.end('Modem duplikat'); return; @@ -95,7 +101,10 @@ async function modemAdd(req, res) { async function modemAddPrefix(req, res) { const modemName = (req.body.name || '').trim(); - const prefix = (req.body.prefix || '').split(/[, ]+/).map((val) => val.trim().replace(/^0/, '62')).filter((row) => row); + const prefix = (req.body.prefix || '').split(/[, ]+/) + .map((val) => val.trim().replace(/^0/, '62')) + .filter((row) => row); + const index = config.modems.findIndex( (item) => item.name.toUpperCase() === modemName.toUpperCase(), ); @@ -143,9 +152,10 @@ async function modemUpdateCustomIp(req, res) { const index = config.modems.findIndex( (item) => item.name.toUpperCase() === modemName.toUpperCase(), ); + config.modems[index].url = url; config.modems[index].username = username; - config.modems[index].password = password; + config.modems[index].password = password; if (index < 0) { res.end('Modem tidak ditemukan'); -- 1.9.0