Skip to content

Commit

Permalink
fix: edit subscriber (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
patriciareinoso authored Apr 22, 2024
1 parent 695f2c9 commit 3c3083e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions utils/editSubscriber.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ export const editSubscriber = async ({
};

try {
updateSubscriber(subscriberData);
await updateSubscriber(subscriberData);
if (oldDeviceGroupName != newDeviceGroupName) {
var oldDeviceGroupData = await getDeviceGroupData(oldDeviceGroupName);
oldDeviceGroupData["imsis"].pop(imsi);
updateDeviceGroupData(oldDeviceGroupName, oldDeviceGroupData);

const index = oldDeviceGroupData["imsis"].indexOf(imsi);
oldDeviceGroupData["imsis"].splice(index, 1);
await updateDeviceGroupData(oldDeviceGroupName, oldDeviceGroupData);
var newDeviceGroupData = await getDeviceGroupData(newDeviceGroupName);
newDeviceGroupData["imsis"].push(imsi);
updateDeviceGroupData(newDeviceGroupName, newDeviceGroupData);
await updateDeviceGroupData(newDeviceGroupName, newDeviceGroupData);
}
} catch (error) {
console.error(error);
Expand Down Expand Up @@ -89,7 +89,7 @@ const getDeviceGroupData = async (deviceGroupName: string) => {
},
});

const existingDeviceGroupData = await existingDeviceGroupResponse.json();
var existingDeviceGroupData = await existingDeviceGroupResponse.json();

if (!existingDeviceGroupData["imsis"]) {
existingDeviceGroupData["imsis"] = [];
Expand Down

0 comments on commit 3c3083e

Please sign in to comment.