N
Nuxt8mo ago
abd

nuxt/supabase | Multiple GoTrueClient instances detected in the same browser context.

hello, I am using "@nuxtjs/supabase": "^0.3.5", with nuxtjs I have many supabase functions that I am calling so wanted to concentrate everything into one composable. My supabase composable
export const useSupabase = () => {

const supabase = useSupabaseClient()


async function logoutUser() {
const { error } = await supabase.auth.signOut()
if (error) console.log(error)
const router = useRouter()
router.push('/')
}



const dbinsert = async (data) => {
const { data, error } = await supabase
.from('some-table')
.insert([
{ data: data },
])
}

return { logoutUser, dbinsert }
}
export const useSupabase = () => {

const supabase = useSupabaseClient()


async function logoutUser() {
const { error } = await supabase.auth.signOut()
if (error) console.log(error)
const router = useRouter()
router.push('/')
}



const dbinsert = async (data) => {
const { data, error } = await supabase
.from('some-table')
.insert([
{ data: data },
])
}

return { logoutUser, dbinsert }
}
in one of my components I am importing the logout function
function logout() {
const { logoutUser } = useSupabase()
logoutUser()
}
function logout() {
const { logoutUser } = useSupabase()
logoutUser()
}
I am getting this error log in the client (see screenshot) these frames point to the usesupabase composable file as well as the page component that has this logout function. What is wrong with the pattern I am using?
No description
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server