Build & Deploy / build (push) Failing after 5s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
38 lines
1.3 KiB
Vue
38 lines
1.3 KiB
Vue
<script setup lang="ts">
|
|
definePageMeta({ middleware: 'auth' })
|
|
const { t } = useI18n()
|
|
const { api } = useApi()
|
|
const toast = useToast()
|
|
|
|
const form = reactive({ name: '', description: '' })
|
|
const saving = ref(false)
|
|
|
|
async function save() {
|
|
saving.value = true
|
|
try {
|
|
await api('/api/routines', { method: 'POST', body: { name: form.name, description: form.description } })
|
|
await navigateTo('/routines')
|
|
} catch {
|
|
toast.add({ title: t('common.error'), color: 'error' })
|
|
saving.value = false
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<div class="space-y-4 max-w-md mx-auto">
|
|
<UButton to="/routines" icon="i-lucide-arrow-left" color="neutral" variant="ghost" :label="t('common.back')" />
|
|
<h1 class="text-2xl font-black tracking-tight">Nouvelle routine</h1>
|
|
<form class="space-y-4" @submit.prevent="save">
|
|
<UFormField label="Nom">
|
|
<UInput v-model="form.name" size="lg" class="w-full" required />
|
|
</UFormField>
|
|
<UFormField label="Description">
|
|
<UTextarea v-model="form.description" class="w-full" :rows="3" />
|
|
</UFormField>
|
|
<UButton type="submit" block size="lg" color="primary" class="font-bold" :loading="saving" :label="t('common.save')" />
|
|
</form>
|
|
<p class="text-xs text-zinc-400 text-center">Tu pourras ajouter des exercices ensuite depuis la routine.</p>
|
|
</div>
|
|
</template>
|