From 17ce170ab33aa9064585e49c05340d979f3e37d9 Mon Sep 17 00:00:00 2001 From: 14790897 <14790897abc@gmail.com> Date: Wed, 6 Mar 2024 22:53:16 +0800 Subject: [PATCH] =?UTF-8?q?chore:=20=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8DGi?= =?UTF-8?q?tHub=E7=99=BB=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/[lng]/welcome/page.tsx | 49 ++++++++++++++++++++----------------- components/SignInGitHub.tsx | 3 +++ 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/app/[lng]/welcome/page.tsx b/app/[lng]/welcome/page.tsx index e92a488..dd6b154 100644 --- a/app/[lng]/welcome/page.tsx +++ b/app/[lng]/welcome/page.tsx @@ -1,3 +1,4 @@ +"use server"; import { createClient } from "@/utils/supabase/server"; import Link from "next/link"; import { cookies } from "next/headers"; @@ -6,7 +7,7 @@ import LoadingIndicator from "@/components/LoadingIndicator"; // 确保路径正 import { insertUserProfile } from "@/utils/supabase/supabaseutils"; import React from "react"; export default async function WelcomeScreen() { - const [isLoading, setIsLoading] = React.useState(true); + // const [isLoading, setIsLoading] = React.useState(true); const cookieStore = cookies(); const supabase = createClient(cookieStore); @@ -16,28 +17,30 @@ export default async function WelcomeScreen() { } = await supabase.auth.getUser(); //profiles表 插入用户信息 await insertUserProfile(data, supabase); - setIsLoading(false); - //2秒后跳转到首页 - setTimeout(() => { - redirect("/"); - }, 1000); + // setIsLoading(false); + //1秒后跳转到首页 + // setTimeout(() => { + redirect("/"); + // }, 1000); - return user ? ( -
- Hey, {user.email}! -
-

welcome, {user.email}!

-
-
- ) : ( - - Login - + return ( + <> + {user ? ( +
+ Hey, {user.email}! +
+

welcome, {user.email}!

+
+
+ ) : ( + + Login + + )} + + ); - { - isLoading ? : null; - } } diff --git a/components/SignInGitHub.tsx b/components/SignInGitHub.tsx index ff9df5e..e89822c 100644 --- a/components/SignInGitHub.tsx +++ b/components/SignInGitHub.tsx @@ -34,6 +34,9 @@ export function SignInGitHub() { const supabase = createClient(); const { data, error } = await supabase.auth.signInWithOAuth({ provider: "github", + options: { + redirectTo: "https://www.paperai.life/welcome", + }, }); if (error) { console.error("GitHub authentication failed:", error.message);