27 lines
622 B
Vue
27 lines
622 B
Vue
|
<template>
|
||
|
<h1 class="title">Nouvelle séance</h1>
|
||
|
<AdminForm v-model="film" @save="post" @publish="publish" />
|
||
|
</template>
|
||
|
|
||
|
<script setup lang="ts">
|
||
|
import { Film } from "~/composables/types"
|
||
|
|
||
|
definePageMeta({
|
||
|
layout: "admin",
|
||
|
})
|
||
|
|
||
|
const film = reactive<Film>({})
|
||
|
const { $api } = useNuxtApp()
|
||
|
|
||
|
async function post() {
|
||
|
return await $api.post("films/", { ...film, isConfirmed: true })
|
||
|
// TODO redirect to list ? to edit ?
|
||
|
}
|
||
|
|
||
|
async function publish() {
|
||
|
// TODO validate ? let API do the job ?
|
||
|
return await $api.post("films/", { ...film, isConfirmed: false })
|
||
|
// TODO redirect to list ? to edit ?
|
||
|
}
|
||
|
</script>
|