Skip to content

Commit

Permalink
fix checking for existing address in subscription for add form
Browse files Browse the repository at this point in the history
  • Loading branch information
vol4tim committed Oct 14, 2024
1 parent 4a37677 commit b38729f
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions src/views/RwsSetup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,28 +63,30 @@ export default {
setStatus("error", "You do not have access to this action.");
return;
}
if (devices.devices.value.includes(user)) {
setStatus("error", "The address is already in the subscription.");
return;
}
if (!devices.devices.value.includes(user)) {
const call = await getInstance().rws.setDevices([
...devices.devices.value,
user
]);
const tx = transaction.createTx();
if (devices.devices.value.includes(account.value)) {
await transaction.send(tx, call, setupOwner.value);
} else {
await transaction.send(tx, call);
}
if (tx.error.value) {
if (tx.error.value !== "Cancelled") {
setStatus("error", tx.error.value);
} else {
setStatus("cancel");
}
return;
const call = await getInstance().rws.setDevices([
...devices.devices.value,
user
]);
const tx = transaction.createTx();
if (devices.devices.value.includes(account.value)) {
await transaction.send(tx, call, setupOwner.value);
} else {
await transaction.send(tx, call);
}
if (tx.error.value) {
if (tx.error.value !== "Cancelled") {
setStatus("error", tx.error.value);
} else {
await devices.loadDevices();
setStatus("cancel");
}
return;
} else {
await devices.loadDevices();
}
store.commit("rws/setUsers", devices.devices);
setStatus("ok");
Expand Down

0 comments on commit b38729f

Please sign in to comment.