Skip to content

Commit 8dace6e

Browse files
committed
fix: set apikey instead of append
1 parent 5ff8055 commit 8dace6e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/lib/fetch.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ export const resolveHeadersConstructor = () => {
2323
}
2424

2525
export const fetchWithAuth = (
26-
supabaseAnonKey: string,
26+
supabaseKey: string,
2727
getAccessToken: () => Promise<string | null>,
2828
customFetch?: Fetch
2929
): Fetch => {
3030
const fetch = resolveFetch(customFetch)
3131
const HeadersConstructor = resolveHeadersConstructor()
3232

3333
return async (input, init) => {
34-
const accessToken = (await getAccessToken()) ?? supabaseAnonKey
34+
const accessToken = (await getAccessToken()) ?? supabaseKey
3535
let headers = new HeadersConstructor(init?.headers)
3636

3737
if (!headers.has('apikey')) {
38-
headers.append('apikey', supabaseAnonKey)
38+
headers.set('apikey', supabaseKey)
3939
}
4040

4141
if (!headers.has('Authorization')) {

0 commit comments

Comments
 (0)