chore: 尝试修复GitHub登录
This commit is contained in:
parent
c037ac1db5
commit
17ce170ab3
|
@ -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 ? (
|
||||
<div className="flex items-center gap-4">
|
||||
Hey, {user.email}!
|
||||
<div style={{ margin: "20px", textAlign: "center" }}>
|
||||
<h1>welcome, {user.email}!</h1>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<Link
|
||||
href="/login"
|
||||
className="py-2 px-3 flex rounded-md no-underline bg-btn-background hover:bg-btn-background-hover"
|
||||
>
|
||||
Login
|
||||
</Link>
|
||||
return (
|
||||
<>
|
||||
{user ? (
|
||||
<div className="flex items-center gap-4">
|
||||
Hey, {user.email}!
|
||||
<div style={{ margin: "20px", textAlign: "center" }}>
|
||||
<h1>welcome, {user.email}!</h1>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<Link
|
||||
href="/login"
|
||||
className="py-2 px-3 flex rounded-md no-underline bg-btn-background hover:bg-btn-background-hover"
|
||||
>
|
||||
Login
|
||||
</Link>
|
||||
)}
|
||||
<LoadingIndicator />
|
||||
</>
|
||||
);
|
||||
{
|
||||
isLoading ? <LoadingIndicator /> : null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user