@cfxdevkit/wallet-connect / useAuthFetch
Function: useAuthFetch()
useAuthFetch(): (
input,init?) =>Promise<Response>
Defined in: auth-context.tsx:406
useAuthFetch — returns a fetch-compatible function that:
- Automatically injects
Authorization: Bearer <token>on every request. - Calls
refreshAuth()when the server responds with HTTP 401, so the SIWE auto-sign flow re-fires and the user is silently re-authenticated with the same wallet (no manual action required on any device).
Usage: const authFetch = useAuthFetch(); const res = await authFetch(‘/api/jobs’);
Returns
(
input,init?):Promise<Response>
Parameters
input
RequestInfo | URL
init?
RequestInit
Returns
Promise<Response>