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:
Giancarlo Buomprisco
2024-08-14 17:13:59 +08:00
committed by GitHub
parent 2f0c4b4ae3
commit ba6e649461
41 changed files with 209 additions and 168 deletions

View File

@@ -2,12 +2,12 @@ import { redirect } from 'next/navigation';
import type { NextRequest } from 'next/server';
import { createAuthCallbackService } from '@kit/supabase/auth';
import { getSupabaseRouteHandlerClient } from '@kit/supabase/route-handler-client';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import pathsConfig from '~/config/paths.config';
export async function GET(request: NextRequest) {
const service = createAuthCallbackService(getSupabaseRouteHandlerClient());
const service = createAuthCallbackService(getSupabaseServerClient());
const { nextPath } = await service.exchangeCodeForSession(request, {
joinTeamPath: pathsConfig.app.joinTeam,

View File

@@ -1,12 +1,12 @@
import { NextRequest, NextResponse } from 'next/server';
import { createAuthCallbackService } from '@kit/supabase/auth';
import { getSupabaseRouteHandlerClient } from '@kit/supabase/route-handler-client';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import pathsConfig from '~/config/paths.config';
export async function GET(request: NextRequest) {
const service = createAuthCallbackService(getSupabaseRouteHandlerClient());
const service = createAuthCallbackService(getSupabaseServerClient());
const url = await service.verifyTokenHash(request, {
joinTeamPath: pathsConfig.app.joinTeam,

View File

@@ -2,7 +2,7 @@ import { redirect } from 'next/navigation';
import { MultiFactorChallengeContainer } from '@kit/auth/mfa';
import { checkRequiresMultiFactorAuthentication } from '@kit/supabase/check-requires-mfa';
import { getSupabaseServerComponentClient } from '@kit/supabase/server-component-client';
import { getSupabaseServerClient } from '@kit/supabase/server-client';
import pathsConfig from '~/config/paths.config';
import { createI18nServerInstance } from '~/lib/i18n/i18n.server';
@@ -23,7 +23,7 @@ export const generateMetadata = async () => {
};
async function VerifyPage(props: Props) {
const client = getSupabaseServerComponentClient();
const client = getSupabaseServerClient();
const {
data: { user },