Bruno Predot

Ajout type.

... ... @@ -2,6 +2,7 @@
//#region --Import--.
import { useVuelidate } from "@vuelidate/core";
import { helpers, maxLength, maxValue, minLength, minValue, required } from "@vuelidate/validators";
import type { Comment } from "~/type/commentForm";
//#endregion
//#region --Emit--.
... ... @@ -20,7 +21,7 @@ defineProps({
//#endregion
//#region --Data/ref--.
const initialState = {
const initialState: Comment = {
username: "",
message: "",
rating: 5,
... ...
... ... @@ -7,6 +7,7 @@ import { Movie } from "~/models/movie";
import type { MovieInterface } from "~/interfaces/movie";
import { Credit } from "~/models/credit";
import type { CreditsResponse } from "~/interfaces/credit";
import type { Comment } from "~/type/commentForm";
//#endregion
//#region --Declaration--.
... ... @@ -103,6 +104,10 @@ async function fetchCredits(id: number | string) {
}
}
function handleSubmitEvent(event: Comment) {
console.log('submitted', event)
}
//#endregion
//#region --Global event--.
... ... @@ -178,7 +183,7 @@ onMounted(() => {
</div>
</div>
<!-- Comments form. -->
<form-movie-comment-form @event:submit="console.log('submitted !', $event)" />
<form-movie-comment-form @event:submit="handleSubmitEvent" />
</section>
</div>
</div>
... ...
export type Comment = {
username: string
message: string
rating: number
}
\ No newline at end of file
... ...