chore: shorten verbose block comments across SaaS branch

This commit is contained in:
Anthony Stirling
2026-06-08 18:38:00 +01:00
parent 8b2baaf0a0
commit 1d5ce8a1d2
12 changed files with 24 additions and 159 deletions
@@ -1,20 +1,7 @@
import type { AxiosInstance } from "axios";
import { supabase } from "@app/auth/supabase";
/**
* SaaS auth headers for raw fetch() calls (e.g. AI chat streaming).
*
* Pulls the live Supabase access token. Required because the SaaS apiClient's
* axios interceptor attaches this header to every axios call, but raw fetch()
* calls bypass that path and end up with no Authorization header → backend
* returns 401. The chat streaming endpoint uses fetch() (not axios) because
* axios doesn't stream SSE responses well, so this override exists to give
* it the same bearer token the axios calls already get.
*
* supabase.auth.getSession() reads from in-memory cache when possible; only
* issues a network request if the session needs refreshing. Adds an Accept
* header so the backend negotiates JSON correctly.
*/
/** SaaS auth headers for raw fetch() calls — Supabase access token from current session. */
export async function getAuthHeaders(): Promise<Record<string, string>> {
const headers: Record<string, string> = {};
try {
@@ -30,12 +17,5 @@ export async function getAuthHeaders(): Promise<Record<string, string>> {
return headers;
}
/**
* SaaS apiClient wires up its own interceptors inline (see saas/services/apiClient.ts).
* This re-export exists so the cascade through @app/services/apiClientSetup
* remains consistent for callers that import setupApiInterceptors — currently
* none in SaaS mode, but keeps the shape uniform.
*/
export function setupApiInterceptors(_client: AxiosInstance): void {
// No-op: SaaS apiClient handles its own interceptors with the Supabase session.
}
/** No-op: SaaS apiClient wires its own interceptors (see saas/services/apiClient.ts). */
export function setupApiInterceptors(_client: AxiosInstance): void {}
+1 -2
View File
@@ -1,8 +1,7 @@
import { URL_TO_TOOL_MAP } from "@app/utils/urlMapping";
import { BASE_PATH } from "@app/constants/app";
// BASE_PATH is "/bpp" or "" (no trailing slash). Strip the leading slash
// to match the legacy SUBPATH shape used below ("bpp" or "").
// "bpp" or "" — BASE_PATH without leading slash.
const SUBPATH = BASE_PATH.replace(/^\//, "");
/**