From 8dace6e4148eca52db7e95eec96c4a56c5eb9ce6 Mon Sep 17 00:00:00 2001 From: Alaister Young Date: Tue, 7 Jun 2022 17:09:06 +1000 Subject: [PATCH] fix: set apikey instead of append --- src/lib/fetch.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/fetch.ts b/src/lib/fetch.ts index 662977d8..dfbe256b 100644 --- a/src/lib/fetch.ts +++ b/src/lib/fetch.ts @@ -23,7 +23,7 @@ export const resolveHeadersConstructor = () => { } export const fetchWithAuth = ( - supabaseAnonKey: string, + supabaseKey: string, getAccessToken: () => Promise, customFetch?: Fetch ): Fetch => { @@ -31,11 +31,11 @@ export const fetchWithAuth = ( const HeadersConstructor = resolveHeadersConstructor() return async (input, init) => { - const accessToken = (await getAccessToken()) ?? supabaseAnonKey + const accessToken = (await getAccessToken()) ?? supabaseKey let headers = new HeadersConstructor(init?.headers) if (!headers.has('apikey')) { - headers.append('apikey', supabaseAnonKey) + headers.set('apikey', supabaseKey) } if (!headers.has('Authorization')) {