Commit e4cdd091b4d367650d4b6f341a0f18628f2953a2

Authored by Adhidarma Hadiwinoto
1 parent c4a8ece634
Exists in master and in 1 other branch webadmin

ESLINTED

Showing 1 changed file with 14 additions and 4 deletions Side-by-side Diff

lib/webadmin/router/config.js
... ... @@ -79,9 +79,15 @@ async function modemAdd(req, res) {
79 79 name: (req.body.name || '').trim(),
80 80 imsi: (req.body.imsi || '').trim(),
81 81 outgoing: !!req.body.outgoing,
82   - prefix: (req.body.prefix || '').split(/[, ]+/).map((val) => val.trim().replace(/^0/, '62')).filter((row) => row),
  82 + prefix: (req.body.prefix || '').split(/[, ]+/)
  83 + .map((val) => val.trim().replace(/^0/, '62'))
  84 + .filter((row) => row),
83 85 };
84   - const index = config.modems.find((item) => item.name.toUpperCase() === modem.name.toUpperCase());
  86 +
  87 + const index = config.modems.find(
  88 + (item) => item.name.toUpperCase() === modem.name.toUpperCase(),
  89 + );
  90 +
85 91 if (index >= 0) {
86 92 res.end('Modem duplikat');
87 93 return;
... ... @@ -95,7 +101,10 @@ async function modemAdd(req, res) {
95 101  
96 102 async function modemAddPrefix(req, res) {
97 103 const modemName = (req.body.name || '').trim();
98   - const prefix = (req.body.prefix || '').split(/[, ]+/).map((val) => val.trim().replace(/^0/, '62')).filter((row) => row);
  104 + const prefix = (req.body.prefix || '').split(/[, ]+/)
  105 + .map((val) => val.trim().replace(/^0/, '62'))
  106 + .filter((row) => row);
  107 +
99 108 const index = config.modems.findIndex(
100 109 (item) => item.name.toUpperCase() === modemName.toUpperCase(),
101 110 );
... ... @@ -143,9 +152,10 @@ async function modemUpdateCustomIp(req, res) {
143 152 const index = config.modems.findIndex(
144 153 (item) => item.name.toUpperCase() === modemName.toUpperCase(),
145 154 );
  155 +
146 156 config.modems[index].url = url;
147 157 config.modems[index].username = username;
148   - config.modems[index].password = password;
  158 + config.modems[index].password = password;
149 159  
150 160 if (index < 0) {
151 161 res.end('Modem tidak ditemukan');