deleteAll

Ah, thanks for the alarms thing, didn't know that. Also, I know it's in-memory, but I want to do:
if (config.holdAfterDeletion) {
await this.setStatus("reserved");
await this.ctx.storage.delete("resolvedUuid");
} else {
this.status = 'available'
await this.ctx.storage.deleteAll()
}

return {
success: true,
newStatus: this.status,
};
if (config.holdAfterDeletion) {
await this.setStatus("reserved");
await this.ctx.storage.delete("resolvedUuid");
} else {
this.status = 'available'
await this.ctx.storage.deleteAll()
}

return {
success: true,
newStatus: this.status,
};
instead of having a return in both if-blocks
2 Replies
Unknown User
Unknown User20h ago
Message Not Public
Sign In & Join Server To View
veeque
veequeOP15h ago
it's not really a problem, just a "making sure everything is how i expect it to be". i must have the if statement, and having the return twice bothered me a bit, so i figured that since the only thing changing is the status being returned, if i set the value in memory (even if i delete it from storage) i can return the correct value without undoing the deletion from storage (thus saving on cost).

Did you find this page helpful?