From 7fe725bdeb702455337e93cb57914f9e596793c3 Mon Sep 17 00:00:00 2001 From: = <=> Date: Mon, 29 Sep 2025 09:24:10 -0300 Subject: [PATCH] refactor(geral): implementando gerenciador de erro nos datas --- .../TTBAndamentoServico/TTBAndamentoServicoIndexData.ts | 7 +++++-- .../TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts | 7 +++++-- .../useTTBAndamentoServicoDeleteHook.ts | 2 +- .../useTTBAndamentoServicoReadHook.ts | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoIndexData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoIndexData.ts index 3865338..cfb11af 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoIndexData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoIndexData.ts @@ -1,9 +1,10 @@ 'use server' +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; import API from "@/services/api/Api"; import { Methods } from "@/services/api/enums/ApiMethodEnum"; -export default async function TTBAndamentoServicoIndexData() { +async function executeTTBAndamentoServicoIndexData() { const api = new API(); @@ -14,4 +15,6 @@ export default async function TTBAndamentoServicoIndexData() { return response; -} \ No newline at end of file +} + +export const TTBAndamentoServicoIndexData = withClientErrorHandler(executeTTBAndamentoServicoIndexData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts b/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts index 5ad8fc9..cedc970 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData.ts @@ -3,8 +3,9 @@ import API from "@/services/api/Api"; import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface"; import { Methods } from "@/services/api/enums/ApiMethodEnum"; +import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler"; -export default async function TTBAndamentoServicoRemoveData(tTBAndamentoServico: TTBAndamentoServicoInteface) { +async function executeTTBAndamentoServicoRemoveData(tTBAndamentoServico: TTBAndamentoServicoInteface) { const api = new API(); @@ -15,4 +16,6 @@ export default async function TTBAndamentoServicoRemoveData(tTBAndamentoServico: return response; -} \ No newline at end of file +} + +export const TTBAndamentoServicoRemoveData = withClientErrorHandler(executeTTBAndamentoServicoRemoveData) \ No newline at end of file diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook.ts index c3407ee..8e3a115 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoDeleteHook.ts @@ -1,7 +1,7 @@ import { useResponse } from "@/app/_response/ResponseContext" import { useState } from "react"; import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface"; -import TTBAndamentoServicoRemoveData from "../../_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData"; +import { TTBAndamentoServicoRemoveData } from "../../_data/TTBAndamentoServico/TTBAndamentoServicoRemoveData"; export const useTTBAndamentoServicoDeleteHook = () => { diff --git a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook.ts b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook.ts index bc0d99c..5e0eadf 100644 --- a/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook.ts +++ b/src/app/(protected)/(cadastros)/cadastros/_hooks/t_tb_andamentoservico/useTTBAndamentoServicoReadHook.ts @@ -3,7 +3,7 @@ import { useResponse } from "@/app/_response/ResponseContext" import { useState } from "react"; import TTBAndamentoServicoInteface from "../../_interfaces/TTBAndamentoServicoInterface"; -import TTBAndamentoServicoIndexData from "../../_data/TTBAndamentoServico/TTBAndamentoServicoIndexData"; +import { TTBAndamentoServicoIndexData } from "../../_data/TTBAndamentoServico/TTBAndamentoServicoIndexData"; export const useTTBAndamentoServicoReadHook = () => {