mirror of
https://github.com/wharfkit/tutorial-client.git
synced 2026-07-21 16:53:28 +00:00
Utilizing return values to populate task list
This commit is contained in:
+11
-4
@@ -27,13 +27,20 @@
|
||||
})
|
||||
|
||||
// Perform the transaction
|
||||
await session.transact({action})
|
||||
const result = await session.transact({action})
|
||||
|
||||
// If the transaction provided return values, add each of them to the list of tasks
|
||||
if (result.returns) {
|
||||
for (const returnValue of result.returns) {
|
||||
tasks.update((current) => {
|
||||
current.push(returnValue.data)
|
||||
return current
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the form inputs
|
||||
form.reset()
|
||||
|
||||
// Reload the tasks from the smart contract after a short delay
|
||||
setTimeout(getTasks, 500)
|
||||
}
|
||||
|
||||
async function setTaskComplete(id: number, complete: boolean) {
|
||||
|
||||
Reference in New Issue
Block a user