UNPKG

@nhost/nhost-js

Version:

Nhost JavaScript SDK

26 lines 1.17 kB
/** * Session response middleware for the Nhost SDK. * * This module provides middleware functionality to automatically extract * and persist session information from authentication responses, ensuring * that new sessions are properly stored after sign-in operations. */ import type { SessionStorage } from '../session/storage'; import type { ChainFunction } from './fetch'; /** * Creates a fetch middleware that automatically extracts and stores session data from API responses. * * This middleware: * 1. Monitors responses from authentication-related endpoints * 2. Extracts session information when present * 3. Stores the session in the provided storage implementation * 4. Handles session removal on sign-out * * This ensures that session data is always up-to-date in storage after operations * that create or invalidate sessions. * * @param storage - Storage implementation for persisting session data * @returns A middleware function that can be used in the fetch chain */ export declare const updateSessionFromResponseMiddleware: (storage: SessionStorage) => ChainFunction; //# sourceMappingURL=middlewareUpdateSessionFromResponse.d.ts.map