fix: GitHub登入可以插入信息
This commit is contained in:
parent
17ce170ab3
commit
559b4010c2
|
@ -4,6 +4,8 @@ import { createClient } from "@/utils/supabase/server";
|
||||||
import Link from "next/link";
|
import Link from "next/link";
|
||||||
import { cookies } from "next/headers";
|
import { cookies } from "next/headers";
|
||||||
import { redirect } from "next/navigation";
|
import { redirect } from "next/navigation";
|
||||||
|
import { insertUserProfile } from "@/utils/supabase/supabaseutils";
|
||||||
|
|
||||||
// import { signOut } from "@/utils/supabase/serversignout";
|
// import { signOut } from "@/utils/supabase/serversignout";
|
||||||
|
|
||||||
export default async function AuthButton() {
|
export default async function AuthButton() {
|
||||||
|
@ -11,8 +13,11 @@ export default async function AuthButton() {
|
||||||
const supabase = createClient(cookieStore);
|
const supabase = createClient(cookieStore);
|
||||||
|
|
||||||
const {
|
const {
|
||||||
|
data,
|
||||||
data: { user },
|
data: { user },
|
||||||
} = await supabase.auth.getUser();
|
} = await supabase.auth.getUser();
|
||||||
|
//profiles表 插入用户信息
|
||||||
|
await insertUserProfile(data, supabase);
|
||||||
|
|
||||||
const signOut = async () => {
|
const signOut = async () => {
|
||||||
"use server";
|
"use server";
|
||||||
|
|
|
@ -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
|
// 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
|
// in development and sample at a lower rate in production
|
||||||
replaysSessionSampleRate: 0.1,
|
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:
|
// You can remove this option if you're not planning to use the Sentry Session Replay feature:
|
||||||
integrations: [
|
integrations: [
|
||||||
Sentry.replayIntegration({
|
Sentry.replayIntegration({
|
||||||
|
|
|
@ -178,7 +178,12 @@ export async function fetchUserVipStatus(userId: string) {
|
||||||
|
|
||||||
//profiles表 插入用户信息
|
//profiles表 插入用户信息
|
||||||
export async function insertUserProfile(data: any, supabase: SupabaseClient) {
|
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) {
|
if (user) {
|
||||||
const { data, error: profileError } = await supabase
|
const { data, error: profileError } = await supabase
|
||||||
.from("profiles")
|
.from("profiles")
|
||||||
|
@ -186,6 +191,7 @@ export async function insertUserProfile(data: any, supabase: SupabaseClient) {
|
||||||
|
|
||||||
if (profileError) {
|
if (profileError) {
|
||||||
console.error("Failed to create user profile:", profileError);
|
console.error("Failed to create user profile:", profileError);
|
||||||
|
Sentry.captureException(profileError);
|
||||||
}
|
}
|
||||||
//sentry
|
//sentry
|
||||||
Sentry.setUser({
|
Sentry.setUser({
|
||||||
|
|
Loading…
Reference in New Issue
Block a user