Refactored Supabase Clients using the new recommended approach by Supabase by centralizing all clients around one single implementation. (#51)
The previous clients have been marked as deprecated and will be removed at some point.
This commit is contained in:
committed by
GitHub
parent
2f0c4b4ae3
commit
ba6e649461
@@ -9,7 +9,7 @@ import { ZodType, z } from 'zod';
|
||||
|
||||
import { verifyCaptchaToken } from '@kit/auth/captcha/server';
|
||||
import { requireUser } from '@kit/supabase/require-user';
|
||||
import { getSupabaseServerActionClient } from '@kit/supabase/server-actions-client';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
import { captureException, zodParseFactory } from '../utils';
|
||||
|
||||
@@ -63,7 +63,7 @@ export function enhanceAction<
|
||||
// verify the user is authenticated if required
|
||||
if (requireAuth) {
|
||||
// verify the user is authenticated if required
|
||||
const auth = await requireUser(getSupabaseServerActionClient());
|
||||
const auth = await requireUser(getSupabaseServerClient());
|
||||
|
||||
// If the user is not authenticated, redirect to the specified URL.
|
||||
if (!auth.data) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import { z } from 'zod';
|
||||
|
||||
import { verifyCaptchaToken } from '@kit/auth/captcha/server';
|
||||
import { requireUser } from '@kit/supabase/require-user';
|
||||
import { getSupabaseRouteHandlerClient } from '@kit/supabase/route-handler-client';
|
||||
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
||||
|
||||
import { captureException, zodParseFactory } from '../utils';
|
||||
|
||||
@@ -96,7 +96,7 @@ export const enhanceRouteHandler = <
|
||||
}
|
||||
}
|
||||
|
||||
const client = getSupabaseRouteHandlerClient();
|
||||
const client = getSupabaseServerClient();
|
||||
|
||||
const shouldVerifyAuth = params?.auth ?? true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user