friend_TTs413
Need help to convice developers to go to SolidJS
I understand that there are some concerns regarding the migration from React to SolidJS. However, I believe it’s important to consider the benefits and insights from other developers who have undergone a similar transition.
9 replies
redirecting from API route
HI! I'm having some issues with redirecting after exchanging a token with Supabase in my API route deployed on Vercel. The code works fine locally but behaves differently when deployed. I've tried a manual response and ensuring everything is configured correctly.
Here’s how you could approach a modified response logic
export async function GET(event: APIEvent) {
const { request } = event;
const requestUrl = new URL(request.url);
const code = requestUrl.searchParams.get("code");
if (!code) {
console.log("NO CODE");
return Response.redirect(new URL("/app", request.url), 302);
}
const supabase = createClient();
const { error } = await supabase.auth.exchangeCodeForSession(code);
if (error) {
console.log("LOGIN ERROR", error);
return Response.error(); // You might want to return an error response
}
console.log("Redirection to /app");
return Response.redirect(new URL("/app", request.url), 302);
}
I wish my answer is a little helpfull for u
4 replies