2022-04-09 02:56:05 +02:00
|
|
|
<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() {
|
2022-07-14 01:39:19 +02:00
|
|
|
return await $api.post("admin/films/", { ...film, isConfirmed: true })
|
2022-04-09 02:56:05 +02:00
|
|
|
// TODO redirect to list ? to edit ?
|
|
|
|
}
|
|
|
|
|
|
|
|
async function publish() {
|
|
|
|
// TODO validate ? let API do the job ?
|
2022-07-14 01:39:19 +02:00
|
|
|
return await $api.post("admin/films/", { ...film, isConfirmed: false })
|
2022-04-09 02:56:05 +02:00
|
|
|
// TODO redirect to list ? to edit ?
|
|
|
|
}
|
|
|
|
</script>
|