macro add Args passing
This commit is contained in:
parent
d99fc0e4d8
commit
a1e637fead
|
|
@ -120,7 +120,7 @@ const RUN_NAME = USE_CALLBACK(async (...ARGS) => {
|
||||||
CALL_SET({ data: ret, error: null, loading: false });
|
CALL_SET({ data: ret, error: null, loading: false });
|
||||||
ON_STOP_LOADING_IDENTIFIER(notifKey);
|
ON_STOP_LOADING_IDENTIFIER(notifKey);
|
||||||
ON_SUCCESS_IDENTIFIER();
|
ON_SUCCESS_IDENTIFIER();
|
||||||
DONE(ret);
|
DONE(ret, ...ARGS);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
catch(e){
|
catch(e){
|
||||||
|
|
|
||||||
2
macros/useMethod.macro.d.ts
vendored
2
macros/useMethod.macro.d.ts
vendored
|
|
@ -1,5 +1,5 @@
|
||||||
import { CancelablePromise, Error } from "src/services/api";
|
import { CancelablePromise, Error } from "src/services/api";
|
||||||
|
|
||||||
export default function useMethod<T, Arg>(method: (...args: Arg) => CancelablePromise<T>,
|
export default function useMethod<T, Arg>(method: (...args: Arg) => CancelablePromise<T>,
|
||||||
onDone?: (data: T) => void,
|
onDone?: (data: T, ...args: Arg) => void,
|
||||||
onError?: (error: Error) => void = null): [(...args: Arg) => CancelablePromise<T>, { data: T, loading: boolean, error: Error }];
|
onError?: (error: Error) => void = null): [(...args: Arg) => CancelablePromise<T>, { data: T, loading: boolean, error: Error }];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user