@varlet/axle 0.0.22 → 0.0.23
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/es/use.d.ts +1 -1
- package/es/use.js +3 -2
- package/package.json +1 -1
package/es/use.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export interface UseAxleOptions<D = any, R = any, P = Record<string, any>> {
|
|
|
17
17
|
onAfter?(): void;
|
|
18
18
|
onTransform?(response: UnwrapRef<R>, prev: UnwrapRef<D>): UnwrapRef<D>;
|
|
19
19
|
onSuccess?(response: UnwrapRef<R>): void;
|
|
20
|
-
onError?(error: Error
|
|
20
|
+
onError?(error: Error): void;
|
|
21
21
|
}
|
|
22
22
|
export type UseAxleReturn<D, P> = [
|
|
23
23
|
data: Ref<UnwrapRef<D>>,
|
package/es/use.js
CHANGED
|
@@ -3,7 +3,7 @@ export function createUseAxle(options = {}) {
|
|
|
3
3
|
const { onTransform: defaultOnTransform } = options;
|
|
4
4
|
const useAxle = (options) => {
|
|
5
5
|
var _a;
|
|
6
|
-
const { url, runner, immediate, data: initialData, params: initialParams, config: initialConfig, onBefore = () => { }, onAfter = () => { }, onTransform = (_a = defaultOnTransform) !== null && _a !== void 0 ? _a : ((response) => response), onSuccess = () => { }, onError = (
|
|
6
|
+
const { url, runner, immediate, data: initialData, params: initialParams, config: initialConfig, onBefore = () => { }, onAfter = () => { }, onTransform = (_a = defaultOnTransform) !== null && _a !== void 0 ? _a : ((response) => response), onSuccess = () => { }, onError = () => { }, } = options;
|
|
7
7
|
const initialUrl = url;
|
|
8
8
|
const data = ref(initialData);
|
|
9
9
|
const loading = ref(false);
|
|
@@ -21,7 +21,8 @@ export function createUseAxle(options = {}) {
|
|
|
21
21
|
return data.value;
|
|
22
22
|
})
|
|
23
23
|
.catch((responseError) => {
|
|
24
|
-
error.value =
|
|
24
|
+
error.value = responseError;
|
|
25
|
+
onError(responseError);
|
|
25
26
|
throw responseError;
|
|
26
27
|
})
|
|
27
28
|
.finally(() => {
|