20 lines
No EOL
625 B
JavaScript
20 lines
No EOL
625 B
JavaScript
export default defineNuxtPlugin(async () => {
|
|
const { memberData, checkMemberStatus } = useAuth()
|
|
|
|
console.log('🚀 Auth init plugin running on CLIENT')
|
|
|
|
// Only initialize if we don't already have member data
|
|
if (!memberData.value) {
|
|
console.log(' - No member data, checking auth status...')
|
|
|
|
const isAuthenticated = await checkMemberStatus()
|
|
|
|
if (isAuthenticated) {
|
|
console.log(' - ✅ Authentication successful')
|
|
} else {
|
|
console.log(' - ❌ No valid authentication')
|
|
}
|
|
} else {
|
|
console.log(' - ✅ Member data already exists:', memberData.value.email)
|
|
}
|
|
}) |