Improve login and authentication methods to adapt to the SSR mode.
This commit is contained in:
@@ -7,6 +7,7 @@ const route = useRoute()
|
||||
const sending = ref(false)
|
||||
const resent = ref(false)
|
||||
const errorMsg = ref(null)
|
||||
const user = useUser()
|
||||
const resendEmail = async () => {
|
||||
errorMsg.value = null
|
||||
sending.value = true
|
||||
@@ -54,7 +55,7 @@ onNuxtReady(() => {
|
||||
<div v-else>
|
||||
<h2 class="text-h4">Verify your email</h2>
|
||||
<p class="mt-5">
|
||||
We've sent a verification email to <strong>{{ $auth.user.email }}</strong>. <br>
|
||||
We've sent a verification email to <strong>{{ user.email }}</strong>. <br>
|
||||
Please check your inbox and click the link to verify your email address.
|
||||
</p>
|
||||
<p v-if="errorMsg"
|
||||
|
||||
@@ -24,7 +24,6 @@ const fieldErrors = ref({
|
||||
new_password1: '',
|
||||
new_password2: '',
|
||||
})
|
||||
const { $auth } = useNuxtApp()
|
||||
const errorMsg = ref(null)
|
||||
const resetForm = ref(null)
|
||||
const valid = ref(true)
|
||||
@@ -37,7 +36,7 @@ const signOut = async () => {
|
||||
method: 'POST'
|
||||
})
|
||||
if (!error.value) {
|
||||
await $auth.logout()
|
||||
await logout()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,7 +84,6 @@ const formRules = ref({
|
||||
v => !!v || 'Password is required'
|
||||
]
|
||||
})
|
||||
const { $auth } = useNuxtApp()
|
||||
const errorMsg = ref(null)
|
||||
const signInForm = ref(null)
|
||||
const submitting = ref(false)
|
||||
|
||||
@@ -3,8 +3,6 @@ definePageMeta({
|
||||
layout: 'vuetify-app'
|
||||
})
|
||||
|
||||
const { $auth } = useNuxtApp()
|
||||
|
||||
const formData = ref({
|
||||
username: '',
|
||||
email: '',
|
||||
@@ -74,7 +72,7 @@ const submit = async () => {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$auth.setUser(data.value.user)
|
||||
setUser(data.value.user)
|
||||
navigateTo('/account/onboarding?email_verification_required='+data.value.email_verification_required)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user