diff --git a/functions/README.md b/functions/README.md index 5008942..3fa13ff 100644 --- a/functions/README.md +++ b/functions/README.md @@ -27,6 +27,8 @@ The `useHttpsCallable` hook takes the following parameters: - `functions`: `functions.Functions` instance for your Firebase app - `name`: A `string` representing the name of the function to call +- `options`: An optional `object` with the following properties: + - `timeout`: A `number` representing the timeout in milliseconds for the function call. Default is 70000 ms. Returns: diff --git a/functions/useHttpsCallable.ts b/functions/useHttpsCallable.ts index 28b14f6..ec5da8f 100644 --- a/functions/useHttpsCallable.ts +++ b/functions/useHttpsCallable.ts @@ -2,6 +2,7 @@ import { Functions, httpsCallable, HttpsCallableResult, + HttpsCallableOptions, } from 'firebase/functions'; import { useCallback, useState } from 'react'; @@ -20,7 +21,8 @@ export type HttpsCallableHook< export default ( functions: Functions, - name: string + name: string, + options?: HttpsCallableOptions, ): HttpsCallableHook => { const [error, setError] = useState(); const [loading, setLoading] = useState(false); @@ -31,7 +33,8 @@ export default ( ): Promise | undefined> => { const callable = httpsCallable( functions, - name + name, + options, ); setLoading(true); setError(undefined);