auth-ui-vue
auth-ui-vue copied to clipboard
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'auth')
store/auth.ts
import { createClient } from '@supabase/supabase-js'
export const authStore = defineStore({
id: 'main',
state: () => ({
supabaseClient: null,
}),
actions: {
initialiseSupabase() {
const supabaseUrl = process.env.SUPABASE_URL
const supabaseKey = process.env.SUPABASE_KEY
this.supabaseClient = createClient(supabaseUrl, supabaseKey)
},
},
})
Login.vue
<script setup lang="ts">
// Import predefined theme
import { ThemeSupa } from '@supabase/auth-ui-shared'
import { Auth } from '@nuxtbase/auth-ui-vue'
import { authStore } from '@/stores/auth'
const themeColor = useColorMode()
const store = authStore()
</script>
<template>
<Auth
:supabase-client="store.supabaseClient"
:providers="[]"
:appearance="{
theme: ThemeSupa,
}"
:theme="themeColor.value"
/>
</template>
I have no idear why this should not work. But I get
Uncaught (in promise) TypeError: Cannot read properties of null (reading 'auth')
at f (@nuxtbase_auth-ui-vue.js?v=e511d63d:1418:38)
at fn._withMods.fn._withMods (chunk-7SWADUAP.js?v=e511d63d:10764:12)
at callWithErrorHandling (chunk-7SWADUAP.js?v=e511d63d:1593:18)
at callWithAsyncErrorHandling (chunk-7SWADUAP.js?v=e511d63d:1601:17)
at HTMLFormElement.invoker (chunk-7SWADUAP.js?v=e511d63d:9974:5)
In supabase I get a 200 request.