nextspace
    Preparing search index...

    Function fetchWithTokenRefresh

    • Wrapper for fetch that automatically handles token refresh on 401 responses.

      Refresh deduplication is now handled centrally by TokenManager.refresh(), which ensures that concurrent callers (both HTTP and WebSocket) all share the same in-flight promise.

      Parameters

      • url: string

        The URL to fetch

      • options: RequestInit

        Fetch options

      • useStoredTokens: boolean = false

        Whether to automatically use stored tokens for authorization

      Returns Promise<Response>

      Promise with the fetch response