@data-fair/lib-vue 1.20.0 → 1.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/async-action.js +9 -6
- package/package.json +1 -1
package/async-action.js
CHANGED
|
@@ -26,14 +26,17 @@ export function useAsyncAction (fn, options) {
|
|
|
26
26
|
if (options?.finally) { await options?.finally() }
|
|
27
27
|
return result
|
|
28
28
|
} catch (err) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
const abortError = err.name === 'AbortError' || err.cause?.name === 'AbortError'
|
|
30
|
+
if (!abortError) {
|
|
31
|
+
error.value = getErrorMsg(err)
|
|
32
|
+
const errorNotif = getFullNotif({ msg: options?.error ?? '', error: err })
|
|
33
|
+
notif.value = errorNotif
|
|
34
|
+
if (options?.catch !== 'error' && options?.catch !== 'all') {
|
|
35
|
+
sendUiNotif(errorNotif)
|
|
36
|
+
}
|
|
34
37
|
}
|
|
35
38
|
loading.value = false
|
|
36
|
-
if (options?.finally) { await options?.finally() }
|
|
39
|
+
if (options?.finally && !abortError) { await options?.finally() }
|
|
37
40
|
}
|
|
38
41
|
}
|
|
39
42
|
return { execute, notif: shallowReadonly(notif), loading: readonly(loading), error: readonly(error) }
|