fix: GitHub登入可以插入信息

This commit is contained in:
14790897 2024-03-07 10:08:17 +08:00
parent 17ce170ab3
commit 559b4010c2
3 changed files with 19 additions and 2 deletions

View File

@ -4,6 +4,8 @@ import { createClient } from "@/utils/supabase/server";
import Link from "next/link";
import { cookies } from "next/headers";
import { redirect } from "next/navigation";
import { insertUserProfile } from "@/utils/supabase/supabaseutils";
// import { signOut } from "@/utils/supabase/serversignout";
export default async function AuthButton() {
@ -11,8 +13,11 @@ export default async function AuthButton() {
const supabase = createClient(cookieStore);
const {
data,
data: { user },
} = await supabase.auth.getUser();
//profiles表 插入用户信息
await insertUserProfile(data, supabase);
const signOut = async () => {
"use server";

View File

@ -18,7 +18,13 @@ if (process.env.NODE_ENV === "production") {
// This sets the sample rate to be 10%. You may want this to be 100% while
// in development and sample at a lower rate in production
replaysSessionSampleRate: 0.1,
beforeSend(event, hint) {
// 检查事件是否为通过 `captureMessage` 发送的
if (event.logger === "javascript" && event.message) {
return event; // 允许发送消息事件
}
return null; // 过滤掉其他类型的事件
},
// You can remove this option if you're not planning to use the Sentry Session Replay feature:
integrations: [
Sentry.replayIntegration({

View File

@ -178,7 +178,12 @@ export async function fetchUserVipStatus(userId: string) {
//profiles表 插入用户信息
export async function insertUserProfile(data: any, supabase: SupabaseClient) {
const user = data?.user;
let user;
if (data.user) {
user = data.user;
} else {
user = data;
}
if (user) {
const { data, error: profileError } = await supabase
.from("profiles")
@ -186,6 +191,7 @@ export async function insertUserProfile(data: any, supabase: SupabaseClient) {
if (profileError) {
console.error("Failed to create user profile:", profileError);
Sentry.captureException(profileError);
}
//sentry
Sentry.setUser({