This commit is contained in:
hailin 2025-05-20 18:33:59 +08:00
parent 912d6c012f
commit 17c59dbb91
4 changed files with 9 additions and 10 deletions

View File

@ -16,8 +16,7 @@ import { getAssistantImageFromStorage } from "@/db/storage/assistant-images"
import { getToolWorkspacesByWorkspaceId } from "@/db/tools"
import { getWorkspaceById } from "@/db/workspaces"
import { convertBlobToBase64 } from "@/lib/blob-to-b64"
//import { supabase } from "@/lib/supabase/browser-client"
import { createClient } from "@/lib/supabase/browser-client"
import { supabase } from "@/lib/supabase/browser-client"
import { LLMID } from "@/types"
import { useParams, useRouter, useSearchParams } from "next/navigation"
import { ReactNode, useContext, useEffect, useState } from "react"
@ -75,7 +74,6 @@ export default function WorkspaceLayout({ children }: WorkspaceLayoutProps) {
useEffect(() => {
;(async () => {
const supabase = await createClient()
const session = (await supabase.auth.getSession()).data.session
if (!session) {

View File

@ -1,8 +1,7 @@
"use client"
import { ChangePassword } from "@/components/utility/change-password"
//import { supabase } from "@/lib/supabase/browser-client"
import { createClient } from "@/lib/supabase/browser-client"
import { supabase } from "@/lib/supabase/browser-client"
import { useRouter } from "next/navigation"
import { useEffect, useState } from "react"
@ -18,7 +17,6 @@ export default function ChangePasswordPage() {
useEffect(() => {
;(async () => {
const supabase = await createClient()
const session = (await supabase.auth.getSession()).data.session
if (!session) {

View File

@ -10,8 +10,7 @@ import {
fetchHostedModels,
fetchOpenRouterModels
} from "@/lib/models/fetch-models"
//import { supabase } from "@/lib/supabase/browser-client"
import { createClient } from "@/lib/supabase/browser-client"
import { supabase } from "@/lib/supabase/browser-client"
import { TablesUpdate } from "@/supabase/types"
import { useRouter } from "next/navigation"
import { useContext, useEffect, useState } from "react"
@ -97,7 +96,6 @@ export default function SetupPage() {
useEffect(() => {
;(async () => {
const supabase = await createClient()
const session = (await supabase.auth.getSession()).data.session
if (!session) {
@ -153,7 +151,6 @@ export default function SetupPage() {
}
const handleSaveSetupSetting = async () => {
const supabase = await createClient()
const session = (await supabase.auth.getSession()).data.session
if (!session) {
// return router.push(`/${locale}/login`)

View File

@ -25,6 +25,12 @@ export async function createClient() {
return _supabase
}
// Export the supabase client directly for easier usage
export const supabase = async () => {
// Simply return the client created by createClient
return await createClient()
}
async function getRuntimeSupabaseUrl(retry = 30, interval = 50): Promise<string> {
for (let i = 0; i < retry; i++) {
const url = window?.RUNTIME_ENV?.SUPABASE_URL