Skip to content

Commit

Permalink
Fix null data on Firebase Functions backend (#99)
Browse files Browse the repository at this point in the history
* move callable initialization outside callback

* remove `call` and simply invoke
  • Loading branch information
erayerdin authored Nov 3, 2024
1 parent 146e708 commit 38c78d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/functions/useCallFunction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ export const useCallFunction = (
{ name, httpsCallableOptions }: UseCallFunctionOptions,
): UseCallFunction => {
const [state, setState] = useState<UseCallFunctionState>("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;
};
Expand Down

0 comments on commit 38c78d1

Please sign in to comment.