diff --git a/src/functions/useCallFunction.ts b/src/functions/useCallFunction.ts index 33f4a83..d09c715 100644 --- a/src/functions/useCallFunction.ts +++ b/src/functions/useCallFunction.ts @@ -30,10 +30,11 @@ export const useCallFunction = ( { name, httpsCallableOptions }: UseCallFunctionOptions, ): UseCallFunction => { const [state, setState] = useState("ready"); + const callable = httpsCallable(functions, name, httpsCallableOptions); const invoke: UseCallFunctionInvoker = async (data: unknown = {}) => { setState("loading"); - const r = httpsCallable(functions, name, httpsCallableOptions).call(data); + const r = callable(data); setState("done"); return r; };