Layout 100%, Notificações, SetupWizard
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// src/composables/useNotifications.js
|
||||
import { onMounted, onUnmounted } from 'vue'
|
||||
import { supabase } from '@/lib/supabase/client'
|
||||
import { useNotificationStore } from '@/stores/notificationStore'
|
||||
|
||||
export function useNotifications () {
|
||||
const store = useNotificationStore()
|
||||
|
||||
onMounted(async () => {
|
||||
const { data, error } = await supabase.auth.getUser()
|
||||
if (error || !data?.user?.id) return
|
||||
|
||||
const ownerId = data.user.id
|
||||
await store.load(ownerId)
|
||||
store.subscribeRealtime(ownerId)
|
||||
})
|
||||
|
||||
onUnmounted(() => {
|
||||
store.unsubscribe()
|
||||
})
|
||||
|
||||
return store
|
||||
}
|
||||
Reference in New Issue
Block a user