Merge branch 'bugfix/various-fixes' into feature/confirm-trade-changes

This commit is contained in:
RubenPX 2022-05-03 11:10:19 +02:00
commit e31e3d3d45

View file

@ -352,14 +352,16 @@ async function processSelectedDevices() {
this.list.forEach(async action => { this.list.forEach(async action => {
if (action.type == "Add") { if (action.type == "Add") {
try { try {
await Api.devices_add(action.lot.id, action.devices.map(dev => dev.id)); const devicesIDs = action.devices.filter(dev => !action.lot.devices.includes(dev.id)).map(dev => dev.id)
await Api.devices_add(action.lot.id, devicesIDs);
this.notifyUser("Devices sucefully aded to selected lot/s", "", false); this.notifyUser("Devices sucefully aded to selected lot/s", "", false);
} catch (error) { } catch (error) {
this.notifyUser("Failed to add devices to selected lot/s", error.responseJSON.message, true); this.notifyUser("Failed to add devices to selected lot/s", error.responseJSON.message, true);
} }
} else if (action.type == "Remove") { } else if (action.type == "Remove") {
try { try {
await Api.devices_remove(action.lot.id, action.devices.map(dev => dev.id)); const devicesIDs = action.devices.filter(dev => action.lot.devices.includes(dev.id)).map(dev => dev.id)
await Api.devices_remove(action.lot.id, devicesIDs);
this.notifyUser("Devices sucefully removed from selected lot/s", "", false); this.notifyUser("Devices sucefully removed from selected lot/s", "", false);
} catch (error) { } catch (error) {
this.notifyUser("Fail to remove devices from selected lot/s", error.responseJSON.message, true); this.notifyUser("Fail to remove devices from selected lot/s", error.responseJSON.message, true);