cineclub-site/front/pages/admin/nouveau.vue

28 lines
709 B
Vue
Raw Normal View History

<template>
2022-12-04 00:34:34 +01:00
<main class="section">
2022-08-27 16:53:52 +02:00
<h1 class="title">Nouvelle séance</h1>
<AdminForm v-model="film" @save="post" @publish="publish" />
</main>
</template>
<script setup lang="ts">
import { Film } from "~/composables/types"
2022-12-30 22:27:11 +01:00
definePageMeta({ layout: "admin" })
useHead({ title: "Nouvelle séance" })
const film = reactive<Film>({})
const { $api } = useNuxtApp()
async function post() {
return await $api.post("admin/films/", { ...film, isConfirmed: true })
// TODO redirect to list ? to edit ?
}
async function publish() {
// TODO validate ? let API do the job ?
return await $api.post("admin/films/", { ...film, isConfirmed: false })
// TODO redirect to list ? to edit ?
}
</script>