19 lines
595 B
TypeScript
19 lines
595 B
TypeScript
import { redirect } from 'next/navigation';
|
|
import type { NextRequest } from 'next/server';
|
|
|
|
import { createAuthCallbackService } from '@kit/supabase/auth';
|
|
import { getSupabaseServerClient } from '@kit/supabase/server-client';
|
|
|
|
import pathsConfig from '~/config/paths.config';
|
|
|
|
export async function GET(request: NextRequest) {
|
|
const service = createAuthCallbackService(getSupabaseServerClient());
|
|
|
|
const { nextPath } = await service.exchangeCodeForSession(request, {
|
|
joinTeamPath: pathsConfig.app.joinTeam,
|
|
redirectPath: pathsConfig.app.home,
|
|
});
|
|
|
|
return redirect(nextPath);
|
|
}
|