mirror of
https://github.com/domfelipe/mika-agent-assist.git
synced 2026-08-07 11:56:45 +00:00
Changes
Co-authored-by: domfelipe <53182096+domfelipe@users.noreply.github.com>
This commit is contained in:
parent
8a70a19a91
commit
d8f133cd5a
1 changed files with 15 additions and 0 deletions
15
src/integrations/supabase/auth-attacher.ts
Normal file
15
src/integrations/supabase/auth-attacher.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
// This file is automatically generated. Do not edit it directly.
|
||||||
|
import { createMiddleware } from '@tanstack/react-start'
|
||||||
|
import { supabase } from './client'
|
||||||
|
|
||||||
|
// Must be registered as a global `functionMiddleware` in `src/start.ts`; otherwise
|
||||||
|
// the browser never attaches the bearer token to serverFn RPCs.
|
||||||
|
export const attachSupabaseAuth = createMiddleware({ type: 'function' }).client(
|
||||||
|
async ({ next }) => {
|
||||||
|
const { data } = await supabase.auth.getSession()
|
||||||
|
const token = data.session?.access_token
|
||||||
|
return next({
|
||||||
|
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
||||||
|
})
|
||||||
|
},
|
||||||
|
)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue