Commit d542327001213d05d8976d6fbfe02e96b3e2302d

Authored by Adhidarma Hadiwinoto
1 parent 03390ce7bc
Exists in master

A little bugfix

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

lib/apiserver/router-config-senders.js
... ... @@ -52,10 +52,6 @@ function delImsi(data, imsi) {
52 52 }
53 53  
54 54 function addImsi(data, imsi) {
55   - if (!data) {
56   - data = [];
57   - }
58   -
59 55 if (data.indexOf(imsi) >= 0) {
60 56 return false;
61 57 }
... ... @@ -108,6 +104,10 @@ function pageAddForPrefix(req, res, next) {
108 104 return;
109 105 }
110 106  
  107 + if (!config.senders_imsi.prefix_names[req.query.prefix]) {
  108 + config.senders_imsi.prefix_names[req.query.prefix] = [];
  109 + }
  110 +
111 111 res.locals.add_imsi_success = addImsi(config.senders_imsi.prefix_names[req.query.prefix], req.query.imsi);
112 112 next();
113 113 }
... ... @@ -132,6 +132,7 @@ function pageDelForPrefix(req, res) {
132 132 }
133 133  
134 134 delImsi(config.senders_imsi.prefix_names[req.query.prefix], req.query.imsi);
  135 +
135 136 res.json({
136 137 status: 'OK',
137 138 message: 'IMSI berhasil dihapus',