@@ -74,7 +74,7 @@ export interface GalleryPhoto {
7474export type GalleryItem = GalleryPhoto ;
7575
7676// Cookie-based storage adapter for Supabase Client: ZERO tokens or keys ever touch browser localStorage
77- function getCookie ( name : string ) : string | null {
77+ export function getCookie ( name : string ) : string | null {
7878 if ( typeof document === 'undefined' ) return null ;
7979 const nameEQ = encodeURIComponent ( name ) + '=' ;
8080 const ca = document . cookie . split ( ';' ) ;
@@ -382,23 +382,23 @@ export async function saveSessionToDatabase(session: Session | null): Promise<bo
382382}
383383
384384/**
385- * Fetches the user session directly from the database using the HttpOnly cookie.
385+ * Fetches the user session directly from the database using cookies.
386+ * Tokens are kept strictly in cookies and never returned in the API response payload.
386387 */
387388export async function fetchSessionFromDatabase ( ) : Promise < {
388389 user : UserProfile | null ;
389- tokens : { access_token : string ; refresh_token ?: string } | null ;
390390} > {
391391 try {
392392 const res = await fetch ( '/api/auth/session' ) ;
393- if ( ! res . ok ) return { user : null , tokens : null } ;
393+ if ( ! res . ok ) return { user : null } ;
394394 const data = await res . json ( ) ;
395395 if ( data . success && data . user ) {
396- return { user : data . user , tokens : data . tokens || null } ;
396+ return { user : data . user } ;
397397 }
398- return { user : null , tokens : null } ;
398+ return { user : null } ;
399399 } catch ( err ) {
400400 console . warn ( 'fetchSessionFromDatabase error:' , err ) ;
401- return { user : null , tokens : null } ;
401+ return { user : null } ;
402402 }
403403}
404404
0 commit comments