forked from BRETT/BRETT
i18n implemented
This commit is contained in:
+10
-9
@@ -5,6 +5,7 @@ import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
|
||||
const { register } = useAuth()
|
||||
const { t } = useI18n()
|
||||
const name = ref('')
|
||||
const password = ref('')
|
||||
const email = ref('')
|
||||
@@ -21,7 +22,7 @@ async function onSubmit() {
|
||||
}
|
||||
catch (err) {
|
||||
const e = err as { data?: { statusMessage?: string, message?: string } }
|
||||
errorMessage.value = e.data?.statusMessage ?? e.data?.message ?? 'Registrierung fehlgeschlagen'
|
||||
errorMessage.value = e.data?.statusMessage ?? e.data?.message ?? t('auth.registerFailed')
|
||||
}
|
||||
finally {
|
||||
loading.value = false
|
||||
@@ -33,33 +34,33 @@ async function onSubmit() {
|
||||
<div class="mx-auto max-w-sm px-4 lg:px-6">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Registrieren</CardTitle>
|
||||
<CardDescription>Name und Passwort reichen — E-Mail ist optional.</CardDescription>
|
||||
<CardTitle>{{ $t('auth.registerTitle') }}</CardTitle>
|
||||
<CardDescription>{{ $t('auth.registerDesc') }}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<form class="space-y-4" @submit.prevent="onSubmit">
|
||||
<div class="space-y-1.5">
|
||||
<Label for="name">Name</Label>
|
||||
<Label for="name">{{ $t('common.name') }}</Label>
|
||||
<Input id="name" v-model="name" autocomplete="username" required minlength="3" maxlength="50" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<Label for="password">Passwort</Label>
|
||||
<Label for="password">{{ $t('common.password') }}</Label>
|
||||
<Input id="password" v-model="password" type="password" autocomplete="new-password" required minlength="6" />
|
||||
</div>
|
||||
<div class="space-y-1.5">
|
||||
<Label for="email">E-Mail (optional)</Label>
|
||||
<Label for="email">{{ $t('auth.emailOptional') }}</Label>
|
||||
<Input id="email" v-model="email" type="email" autocomplete="email" />
|
||||
</div>
|
||||
<p v-if="errorMessage" class="text-sm text-destructive">
|
||||
{{ errorMessage }}
|
||||
</p>
|
||||
<Button type="submit" class="w-full" :disabled="loading">
|
||||
Konto erstellen
|
||||
{{ $t('auth.createAccount') }}
|
||||
</Button>
|
||||
<p class="text-center text-sm text-muted-foreground">
|
||||
Schon registriert?
|
||||
{{ $t('auth.alreadyRegistered') }}
|
||||
<NuxtLink to="/login" class="text-primary underline">
|
||||
Login
|
||||
{{ $t('auth.loginTitle') }}
|
||||
</NuxtLink>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user