diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensIndexData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensIndexData.ts index c7dda24..db6fec3 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensIndexData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensIndexData.ts @@ -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/` }); -} \ No newline at end of file +} + +export const GTBRegimeBensIndexData = withClientErrorHandler(executeGTBRegimeBensIndexData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensRemoveData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensRemoveData.ts index ebbb985..a69e640 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensRemoveData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensRemoveData.ts @@ -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}` }); -} \ No newline at end of file +} + +export const GTBRegimeBensRemoveData = withClientErrorHandler(executeGTBRegimeBensRemoveData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensSaveData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensSaveData.ts index b469f5b..a0b6280 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensSaveData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/GTBRegimeBens/GTBRegimeBensSaveData.ts @@ -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); diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimebens/useGTBRegimeBensReadHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimebens/useGTBRegimeBensReadHook.ts index 9294db5..0447eee 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimebens/useGTBRegimeBensReadHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimebens/useGTBRegimeBensReadHook.ts @@ -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 = () => { diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimebens/useGTBRegimeBensRemoveHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimebens/useGTBRegimeBensRemoveHook.ts index 748313e..64c909a 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimebens/useGTBRegimeBensRemoveHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/g_tb_regimebens/useGTBRegimeBensRemoveHook.ts @@ -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 = () => { diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensIndexService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensIndexService.ts index b57f1f1..24e98ee 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensIndexService.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensIndexService.ts @@ -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; -} \ No newline at end of file +} + +export const GTBRegimeBensIndexService = withClientErrorHandler(executeGTBRegimeBensIndexService) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensRemoveService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensRemoveService.ts index b194991..2978532 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensRemoveService.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensRemoveService.ts @@ -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; -} \ No newline at end of file +} + +export const GTBRegimeBensRemoveService = withClientErrorHandler(executeGTBRegimeBensRemoveService) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensSaveService.ts b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensSaveService.ts index cf8cefa..0325343 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensSaveService.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_services/g_tb_regimebens/GTBRegimeBensSaveService.ts @@ -10,5 +10,4 @@ async function executeGTBRegimeBensSaveService(data: GTBRegimeBensInterface) { } -// Executa a função de forma encapsulada export const GTBRegimeBensSaveService = withClientErrorHandler(executeGTBRegimeBensSaveService); \ No newline at end of file