diff --git a/src/runtime/composables/useForm.ts b/src/runtime/composables/useForm.ts index 108c0da..1f9e485 100644 --- a/src/runtime/composables/useForm.ts +++ b/src/runtime/composables/useForm.ts @@ -126,7 +126,6 @@ export default function useForm( const _options = { ...options, onBefore: () => { - console.log("onBefore"); this.wasSuccessful = false; this.recentlySuccessful = false; clearTimeout(recentlySuccessfulTimeoutId); @@ -136,7 +135,6 @@ export default function useForm( } }, onStart: (visit) => { - console.log("onStart", visit); this.processing = true; if (options.onStart) { @@ -151,7 +149,6 @@ export default function useForm( } }, onSuccess: async (response) => { - console.log("onSuccess", response); this.processing = false; this.progress = null; this.clearErrors(); @@ -165,7 +162,6 @@ export default function useForm( return onSuccess; }, onError: (errors) => { - console.log("onError", errors); this.processing = false; this.progress = null; this.clearErrors().setError(errors); @@ -175,7 +171,6 @@ export default function useForm( } }, onFinish: (visit) => { - console.log("onFinish"); this.processing = false; this.progress = null; @@ -197,12 +192,9 @@ export default function useForm( method: method, body: data, onRequest: async ({ request, options }) => { - console.log("oFetch onRequest", request, options); - await _options.onStart(); }, onResponse: async ({ response }) => { - console.log("onResponse"); // onResponse is always called, even if there was an errors // return early so we don't execute both this and onResponseError if (!response.ok) { diff --git a/src/runtime/composables/usePrecognitionForm.ts b/src/runtime/composables/usePrecognitionForm.ts index 0efbc38..3c7904c 100644 --- a/src/runtime/composables/usePrecognitionForm.ts +++ b/src/runtime/composables/usePrecognitionForm.ts @@ -22,7 +22,6 @@ export default function usePrecognitionForm } async function validate(fieldName: string) { - console.log("validate", fieldName); // check if the fieldName is an array let onlyFieldsToValidate; const transformedData = this.transform(this.data()); @@ -39,26 +38,21 @@ async function validate(fieldName: string) { const defaultOptions = { onStart: () => { - console.log("precognition onStart"); this.validating = true; }, onSuccess: async (response) => { - console.log("precognition onSuccess", response); this.clearErrors(); }, onError: (errors) => { - console.log("precognitionOnError", errors); this.setError(errors); }, onFinish: () => { - console.log("precognitionOnFinish"); this.validating = false; }, }; const validateOnly = Object.keys(onlyFieldsToValidate).join(); - console.log("precognition oFetch"); try { await $fetch(this.url, { method: this.method, @@ -68,8 +62,6 @@ async function validate(fieldName: string) { }, body: onlyFieldsToValidate, onRequest: async ({ request, options }) => { - console.log("precognition oFetch onRequest", request, options); - await defaultOptions.onStart(); }, onResponse: async (context: FetchContext & { response: FetchResponse }): Promise | void => { @@ -81,7 +73,6 @@ async function validate(fieldName: string) { await this.clearErrors(validateOnly); }, onResponseError: async ({ response }) => { - console.log("precognition onResponseError"); const errors = response._data.data?.errors; await defaultOptions.onError(errors); await defaultOptions.onFinish(); diff --git a/src/runtime/server/utils/definePrecognitionEventHandler.ts b/src/runtime/server/utils/definePrecognitionEventHandler.ts index 1676062..61aa7b5 100644 --- a/src/runtime/server/utils/definePrecognitionEventHandler.ts +++ b/src/runtime/server/utils/definePrecognitionEventHandler.ts @@ -10,13 +10,11 @@ const precognitionEventHandler = ( ): EventHandler => defineEventHandler(async (event) => { // do something before the route handler - console.log("starting precognition event handler"); const headers = getHeaders(event); if (!headers.precognition) { // this is not a precognition event // return the regular response - console.log("Regular event handler running"); return handler(event); } @@ -25,7 +23,6 @@ const precognitionEventHandler = ( const fieldsToValidate = validateOnlyHeader ? validateOnlyHeader.split(",") : []; // this is a precognition event - console.log("Handling precognition event..."); return await processPrecognitionRequest(event, zodObject, fieldsToValidate); });