@bluemarble/bm-components 0.0.99 → 0.1.0

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/index.mjs CHANGED
@@ -3937,6 +3937,8 @@ var ApiHelper = class _ApiHelper {
3937
3937
  createMethods(methods) {
3938
3938
  return (req, res) => __async(this, null, function* () {
3939
3939
  const currentMethod = methods[req.method];
3940
+ if (req.method === "OPTIONS")
3941
+ return res.status(200).end();
3940
3942
  try {
3941
3943
  if (!currentMethod)
3942
3944
  throw new HttpError(405, "M\xE9todo inv\xE1lido");
@@ -3988,7 +3990,7 @@ var ApiHelper = class _ApiHelper {
3988
3990
 
3989
3991
  // src/hooks/useFormHelper.ts
3990
3992
  import axios from "axios";
3991
- import { useEffect as useEffect5, useRef as useRef4 } from "react";
3993
+ import { useContext as useContext3, useEffect as useEffect5, useRef as useRef4 } from "react";
3992
3994
 
3993
3995
  // src/hooks/useAlert.ts
3994
3996
  import { useContext as useContext2 } from "react";
@@ -4076,10 +4078,16 @@ function useLoading() {
4076
4078
  return { isLoading, setLoading };
4077
4079
  }
4078
4080
 
4081
+ // src/contexts/FormHelperProvider.tsx
4082
+ import React28 from "react";
4083
+ import { createContext as createContext3 } from "react";
4084
+ var FormHelperContext = createContext3({});
4085
+
4079
4086
  // src/hooks/useFormHelper.ts
4080
- function useFormHelper({ formatErrorMessage, api }) {
4087
+ function useFormHelper() {
4081
4088
  const alertProps = useAlert();
4082
4089
  const loadingProps = useLoading();
4090
+ const { api, formatErrorMessage } = useContext3(FormHelperContext);
4083
4091
  const { createAlert } = alertProps;
4084
4092
  const { setLoading } = loadingProps;
4085
4093
  const sourceRef = useRef4();