Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
=
688690cd23 refactor(geral): implementando gerenciador de erro nos datas 2025-09-29 09:54:29 -03:00
8 changed files with 25 additions and 14 deletions

View file

@ -1,7 +1,8 @@
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
import API from "@/services/api/Api";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
export default async function GTBRegimeBensIndexData() {
async function executeGTBRegimeBensIndexData() {
const api = new API();
@ -10,4 +11,6 @@ export default async function GTBRegimeBensIndexData() {
endpoint: `administrativo/g_tb_regimebens/`
});
}
}
export const GTBRegimeBensIndexData = withClientErrorHandler(executeGTBRegimeBensIndexData)

View file

@ -1,8 +1,9 @@
import API from "@/services/api/Api";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
import GTBRegimeBensInterface from "../../_interfaces/GTBRegimeBensInterface";
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
export default async function GTBRegimeBensRemoveData(data: GTBRegimeBensInterface) {
async function executeGTBRegimeBensRemoveData(data: GTBRegimeBensInterface) {
const api = new API();
@ -11,4 +12,6 @@ export default async function GTBRegimeBensRemoveData(data: GTBRegimeBensInterfa
endpoint: `administrativo/g_tb_regimebens/${data.tb_regimebens_id}`
});
}
}
export const GTBRegimeBensRemoveData = withClientErrorHandler(executeGTBRegimeBensRemoveData)

View file

@ -5,7 +5,7 @@ import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withCli
async function executeGTBRegimeBensSaveData(data: GTBRegimeBensInterface) {
throw new Error("Nome e email são obrigatórios");
//throw new Error("Nome e email são obrigatórios");
const isUpdate = Boolean(data.tb_regimebens_id);

View file

@ -1,6 +1,6 @@
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import GTBRegimeBensIndexService from "../../_services/g_tb_regimebens/GTBRegimeBensIndexService";
import { GTBRegimeBensIndexService } from "../../_services/g_tb_regimebens/GTBRegimeBensIndexService";
import GTBRegimeBensInterface from "../../_interfaces/GTBRegimeBensInterface";
export const useGTBRegimeBensReadHook = () => {

View file

@ -1,6 +1,6 @@
import { useResponse } from "@/app/_response/ResponseContext"
import GTBRegimeBensInterface from "../../_interfaces/GTBRegimeBensInterface";
import GTBRegimeBensRemoveData from "../../_data/GTBRegimeBens/GTBRegimeBensRemoveData";
import { GTBRegimeBensRemoveData } from "../../_data/GTBRegimeBens/GTBRegimeBensRemoveData";
export const useGTBRegimeBensRemoveHook = () => {

View file

@ -1,9 +1,12 @@
import GTBRegimeBensIndexData from "../../_data/GTBRegimeBens/GTBRegimeBensIndexData";
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
import { GTBRegimeBensIndexData } from "../../_data/GTBRegimeBens/GTBRegimeBensIndexData";
export default async function GTBRegimeBensIndexService() {
async function executeGTBRegimeBensIndexService() {
const response = await GTBRegimeBensIndexData();
return response;
}
}
export const GTBRegimeBensIndexService = withClientErrorHandler(executeGTBRegimeBensIndexService)

View file

@ -1,10 +1,13 @@
import GTBRegimeBensRemoveData from "../../_data/GTBRegimeBens/GTBRegimeBensRemoveData";
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
import { GTBRegimeBensRemoveData } from "../../_data/GTBRegimeBens/GTBRegimeBensRemoveData";
import GTBRegimeBensInterface from "../../_interfaces/GTBRegimeBensInterface";
export default async function GTBRegimeBensRemoveService(data: GTBRegimeBensInterface) {
async function executeGTBRegimeBensRemoveService(data: GTBRegimeBensInterface) {
const response = await GTBRegimeBensRemoveData(data);
return response;
}
}
export const GTBRegimeBensRemoveService = withClientErrorHandler(executeGTBRegimeBensRemoveService)

View file

@ -10,5 +10,4 @@ async function executeGTBRegimeBensSaveService(data: GTBRegimeBensInterface) {
}
// Executa a função de forma encapsulada
export const GTBRegimeBensSaveService = withClientErrorHandler(executeGTBRegimeBensSaveService);