nuxt-outfit 1.2.7 → 1.2.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@nuxt/outfit",
3
3
  "configKey": "outfit",
4
- "version": "1.2.7"
4
+ "version": "1.2.9"
5
5
  }
@@ -9,4 +9,5 @@ export declare const useForm: (opts?: {}) => {
9
9
  reset: () => void;
10
10
  onSuccess: (callback: any) => void;
11
11
  onFail: (callback: any) => void;
12
+ schema: any;
12
13
  };
@@ -1,12 +1,12 @@
1
- import { useRuntimeConfig, useNuxtApp, useState } from "#imports";
1
+ import { useRuntimeConfig, useNuxtApp } from "#imports";
2
2
  import { ref, reactive } from "vue";
3
3
  import { klona as deepClone } from "klona/full";
4
4
  import { has, unset } from "lodash-es";
5
5
  import flat from "flat";
6
6
  export const useForm = (opts = {}) => {
7
+ const { schema } = opts;
7
8
  const httpInstance = useRuntimeConfig().public.outfit.httpInstance;
8
9
  const http = useNuxtApp()?.[httpInstance] ?? $fetch;
9
- const snackMessage = useState("snackMessage");
10
10
  const fields = reactive(deepClone(opts?.initialValues));
11
11
  const isPending = ref(false);
12
12
  const errors = ref({});
@@ -66,8 +66,6 @@ export const useForm = (opts = {}) => {
66
66
  } else if (fail.name === "FetchError") {
67
67
  if (fail.data?.errors !== void 0) {
68
68
  messages = fail.data.errors;
69
- } else if (fail.data?.message !== void 0) {
70
- snackMessage.value = { message: fail.data?.message, type: "error" };
71
69
  }
72
70
  }
73
71
  setErrors(unflatten(messages));
@@ -100,6 +98,7 @@ export const useForm = (opts = {}) => {
100
98
  clearError,
101
99
  reset,
102
100
  onSuccess,
103
- onFail
101
+ onFail,
102
+ schema
104
103
  };
105
104
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-outfit",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
4
4
  "description": "Outfit - Connection Laravel and Nuxt",
5
5
  "repository": {
6
6
  "type": "git",