forked from BRETT/BRETT
i18n implemented
This commit is contained in:
+9
-8
@@ -5,6 +5,7 @@ import { Input } from '@/components/ui/input'
|
||||
import { Label } from '@/components/ui/label'
|
||||
|
||||
const { login } = useAuth()
|
||||
const { t } = useI18n()
|
||||
const name = ref('')
|
||||
const password = ref('')
|
||||
const errorMessage = ref('')
|
||||
@@ -20,7 +21,7 @@ async function onSubmit() {
|
||||
}
|
||||
catch (err) {
|
||||
const e = err as { data?: { statusMessage?: string, message?: string } }
|
||||
errorMessage.value = e.data?.statusMessage ?? e.data?.message ?? 'Login fehlgeschlagen'
|
||||
errorMessage.value = e.data?.statusMessage ?? e.data?.message ?? t('auth.loginFailed')
|
||||
}
|
||||
finally {
|
||||
loading.value = false
|
||||
@@ -32,29 +33,29 @@ async function onSubmit() {
|
||||
<div class="mx-auto max-w-sm px-4 lg:px-6">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Login</CardTitle>
|
||||
<CardDescription>Melde dich mit Name und Passwort an.</CardDescription>
|
||||
<CardTitle>{{ $t('auth.loginTitle') }}</CardTitle>
|
||||
<CardDescription>{{ $t('auth.loginDesc') }}</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 />
|
||||
</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="current-password" required />
|
||||
</div>
|
||||
<p v-if="errorMessage" class="text-sm text-destructive">
|
||||
{{ errorMessage }}
|
||||
</p>
|
||||
<Button type="submit" class="w-full" :disabled="loading">
|
||||
Anmelden
|
||||
{{ $t('auth.login') }}
|
||||
</Button>
|
||||
<p class="text-center text-sm text-muted-foreground">
|
||||
Noch kein Konto?
|
||||
{{ $t('auth.noAccount') }}
|
||||
<NuxtLink to="/register" class="text-primary underline">
|
||||
Registrieren
|
||||
{{ $t('auth.register') }}
|
||||
</NuxtLink>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user