Initialise le front-end Vue
- Vue 3, Vite, TypeScript, Vue Router, vue-i18n, MapLibre GL JS, Bootstrap 5 (CSS seul), Bootstrap Icons, police Roboto. - Pages : connexion, évaluation (adresse, carte avec couches WalOnMap, une carte par facteur avec badge, valeurs mesurées, onglets et références, état « indisponible » avec Réessayer), erreurs 403/404. - Design repris des maquettes Penpot (charte ssmg.be), bureau et mobile. - Garde de navigation, client API avec jeton CSRF ; l'adresse du patient ne quitte pas la mémoire du composant. - 51 tests Vitest ; README et CLAUDE.md mis à jour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d441b11c2
commit
7f29cec2a2
52 files changed
+9347
-4
No files matched your search
@@ -0,0 +1,112 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
|
||||
import { ApiError } from '@/api/client'
|
||||
import AlertBanner from '@/components/AlertBanner.vue'
|
||||
import { useAuth } from '@/composables/useAuth'
|
||||
|
||||
const { login } = useAuth()
|
||||
const router = useRouter()
|
||||
const route = useRoute()
|
||||
|
||||
const email = ref('')
|
||||
const password = ref('')
|
||||
const error = ref('')
|
||||
const loading = ref(false)
|
||||
|
||||
async function onSubmit() {
|
||||
error.value = ''
|
||||
loading.value = true
|
||||
try {
|
||||
await login(email.value, password.value)
|
||||
const next = typeof route.query.next === 'string' && route.query.next.startsWith('/')
|
||||
await router.push(next ? (route.query.next as string) : { name: 'assessment' })
|
||||
} catch (e) {
|
||||
error.value = e instanceof ApiError && e.status === 400 ? e.message : 'login.error'
|
||||
} finally {
|
||||
loading.value = false
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="auth-page">
|
||||
<section class="auth-card prism-card" aria-labelledby="login-title">
|
||||
<h1 id="login-title">{{ $t('login.title') }}</h1>
|
||||
<p class="intro">{{ $t('login.intro') }}</p>
|
||||
|
||||
<AlertBanner v-if="error" variant="error" class="mb-3">
|
||||
{{ error === 'login.error' ? $t('login.error') : error }}
|
||||
</AlertBanner>
|
||||
|
||||
<form novalidate @submit.prevent="onSubmit">
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">{{ $t('login.email') }}</label>
|
||||
<input
|
||||
id="email"
|
||||
v-model="email"
|
||||
type="email"
|
||||
class="form-control"
|
||||
autocomplete="username"
|
||||
required
|
||||
:placeholder="$t('login.emailPlaceholder')"
|
||||
/>
|
||||
</div>
|
||||
<div class="mb-4">
|
||||
<label for="password" class="form-label">{{ $t('login.password') }}</label>
|
||||
<input
|
||||
id="password"
|
||||
v-model="password"
|
||||
type="password"
|
||||
class="form-control"
|
||||
autocomplete="current-password"
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
<button
|
||||
type="submit"
|
||||
class="btn btn-primary w-100"
|
||||
:disabled="loading || !email || !password"
|
||||
>
|
||||
{{ loading ? $t('login.submitting') : $t('login.submit') }}
|
||||
</button>
|
||||
</form>
|
||||
</section>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.auth-page {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 100px 16px;
|
||||
}
|
||||
|
||||
@media (max-width: 575.98px) {
|
||||
.auth-page {
|
||||
padding: 32px 16px;
|
||||
}
|
||||
}
|
||||
|
||||
.auth-card {
|
||||
width: 100%;
|
||||
max-width: 460px;
|
||||
padding: 40px 39px;
|
||||
}
|
||||
|
||||
@media (max-width: 575.98px) {
|
||||
.auth-card {
|
||||
padding: 28px 20px;
|
||||
}
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 1.75rem;
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
|
||||
.intro {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
</style>
|
||||
Reference in new issue
Block a user