mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-28 23:44:19 +00:00
🐛 Fix race condition
This commit is contained in:
parent
c13e5fff40
commit
5e3ef20785
1 changed files with 5 additions and 4 deletions
|
@ -7,16 +7,17 @@
|
||||||
* @returns {(function(): void)|*}
|
* @returns {(function(): void)|*}
|
||||||
*/
|
*/
|
||||||
export default function goToOnSuccess(func, history, destination) {
|
export default function goToOnSuccess(func, history, destination) {
|
||||||
return (...args) => {
|
return async (...args) => {
|
||||||
let result
|
let result
|
||||||
try {
|
try {
|
||||||
console.debug("Provando ad eseguire: ", func)
|
console.debug("Executing: ", func)
|
||||||
result = func(...args)
|
result = await func(...args)
|
||||||
|
console.debug("Executed successfully: ", func, " moving to a different page.")
|
||||||
history.push(destination)
|
history.push(destination)
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
console.debug("Esecuzione fallita: ", func, ", non ha fatto nulla.")
|
console.debug("Execution failed: ", func, ", not doing anything.")
|
||||||
throw e
|
throw e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue