Files
2025-07-01 10:53:26 +00:00

44 lines
1.2 KiB
Vue
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="text-center mt-10">
<h1 class="text-2xl font-bold">E-Mail wird verifiziert...</h1>
<p>Bitte einen Moment Geduld.</p>
</div>
</template>
<script setup>
import { useI18n } from 'vue-i18n'
import { useRoute, useRouter } from 'vue-router'
const route = useRoute()
const router = useRouter()
const localePath = useLocalePath()
const config = useRuntimeConfig()
const apiBase = config.public.apiUrl
onMounted(async () => {
try {
const token = route.params.token
await axios.get(`${apiBase}/api/verify-email/${token}`)
// Weiterleitung mit Query-Param (z.B. für Erfolgsmeldung im Login)
router.push({
path: localePath('/auth/login'),
query: { verified: '1' }
})
} catch (error) {
if (error.response && (error.response.status === 400 || error.response.status === 404)) {
// Token ungültig oder abgelaufen Weiterleitung zur Registrierung
router.push({
path: localePath('/auth/signup'),
query: { error: 'invalid_or_expired_token' }
})
} else {
router.push({
path: localePath('/auth/login'),
query: { error: 'verification_failed' }
})
}
}
})
</script>