Showing
3 changed files
with
13 additions
and
2 deletions
@@ -2,6 +2,7 @@ | @@ -2,6 +2,7 @@ | ||
2 | //#region --Import--. | 2 | //#region --Import--. |
3 | import { useVuelidate } from "@vuelidate/core"; | 3 | import { useVuelidate } from "@vuelidate/core"; |
4 | import { helpers, maxLength, maxValue, minLength, minValue, required } from "@vuelidate/validators"; | 4 | import { helpers, maxLength, maxValue, minLength, minValue, required } from "@vuelidate/validators"; |
5 | +import type { Comment } from "~/type/commentForm"; | ||
5 | //#endregion | 6 | //#endregion |
6 | 7 | ||
7 | //#region --Emit--. | 8 | //#region --Emit--. |
@@ -20,7 +21,7 @@ defineProps({ | @@ -20,7 +21,7 @@ defineProps({ | ||
20 | //#endregion | 21 | //#endregion |
21 | 22 | ||
22 | //#region --Data/ref--. | 23 | //#region --Data/ref--. |
23 | -const initialState = { | 24 | +const initialState: Comment = { |
24 | username: "", | 25 | username: "", |
25 | message: "", | 26 | message: "", |
26 | rating: 5, | 27 | rating: 5, |
@@ -7,6 +7,7 @@ import { Movie } from "~/models/movie"; | @@ -7,6 +7,7 @@ import { Movie } from "~/models/movie"; | ||
7 | import type { MovieInterface } from "~/interfaces/movie"; | 7 | import type { MovieInterface } from "~/interfaces/movie"; |
8 | import { Credit } from "~/models/credit"; | 8 | import { Credit } from "~/models/credit"; |
9 | import type { CreditsResponse } from "~/interfaces/credit"; | 9 | import type { CreditsResponse } from "~/interfaces/credit"; |
10 | +import type { Comment } from "~/type/commentForm"; | ||
10 | //#endregion | 11 | //#endregion |
11 | 12 | ||
12 | //#region --Declaration--. | 13 | //#region --Declaration--. |
@@ -103,6 +104,10 @@ async function fetchCredits(id: number | string) { | @@ -103,6 +104,10 @@ async function fetchCredits(id: number | string) { | ||
103 | } | 104 | } |
104 | } | 105 | } |
105 | 106 | ||
107 | +function handleSubmitEvent(event: Comment) { | ||
108 | + console.log('submitted', event) | ||
109 | +} | ||
110 | + | ||
106 | //#endregion | 111 | //#endregion |
107 | 112 | ||
108 | //#region --Global event--. | 113 | //#region --Global event--. |
@@ -178,7 +183,7 @@ onMounted(() => { | @@ -178,7 +183,7 @@ onMounted(() => { | ||
178 | </div> | 183 | </div> |
179 | </div> | 184 | </div> |
180 | <!-- Comments form. --> | 185 | <!-- Comments form. --> |
181 | - <form-movie-comment-form @event:submit="console.log('submitted !', $event)" /> | 186 | + <form-movie-comment-form @event:submit="handleSubmitEvent" /> |
182 | </section> | 187 | </section> |
183 | </div> | 188 | </div> |
184 | </div> | 189 | </div> |
-
Please register or login to post a comment