refactor(geral): implementando gerenciador de erro nos datas

This commit is contained in:
= 2025-09-29 09:27:12 -03:00
parent eeab66149f
commit 3df00e38bc
6 changed files with 18 additions and 9 deletions

View file

@ -1,8 +1,9 @@
import API from "@/services/api/Api";
import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
export default async function TTBReconhecimentoTipoDeleteData(data: TTBReconhecimentoTipoInterface) {
async function executeTTBReconhecimentoTipoDeleteData(data: TTBReconhecimentoTipoInterface) {
const api = new API();
@ -13,4 +14,6 @@ export default async function TTBReconhecimentoTipoDeleteData(data: TTBReconheci
return response;
}
}
export const TTBReconhecimentoTipoDeleteData = withClientErrorHandler(executeTTBReconhecimentoTipoDeleteData)

View file

@ -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 TTBReconhecimentoTipoIndexData() {
async function executeTTBReconhecimentoTipoIndexData() {
const api = new API();
@ -14,4 +15,6 @@ export default async function TTBReconhecimentoTipoIndexData() {
return response;
}
}
export const TTBReconhecimentoTipoIndexData = withClientErrorHandler(executeTTBReconhecimentoTipoIndexData)

View file

@ -1,8 +1,9 @@
import API from "@/services/api/Api";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface";
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
export default async function TTBReconhecimentoTipoSaveData(data: TTBReconhecimentoTipoInterface) {
async function executeTTBReconhecimentoTipoSaveData(data: TTBReconhecimentoTipoInterface) {
const api = new API();
@ -14,4 +15,6 @@ export default async function TTBReconhecimentoTipoSaveData(data: TTBReconhecime
return response;
}
}
export const TTBReconhecimentoTipoSaveData = withClientErrorHandler(executeTTBReconhecimentoTipoSaveData)

View file

@ -1,6 +1,6 @@
import { useResponse } from "@/app/_response/ResponseContext"
import TTBReconhecimentoTipoInterface from "../../_interfaces/TTBReconhecimentoTipoInterface";
import TTBReconhecimentoTipoDeleteData from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoDeleteData";
import { TTBReconhecimentoTipoDeleteData } from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoDeleteData";
export const useTTBReconhecimentoTipoDeleteHook = () => {

View file

@ -3,7 +3,7 @@
import ITTTBReconhecimentoTipo from '../../_interfaces/TTBReconhecimentoTipoInterface'
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import TTBReconhecimentoTipoIndexData from '../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData';
import { TTBReconhecimentoTipoIndexData } from '../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoIndexData';
export const useTTBReconhecimentoTipoReadHook = () => {

View file

@ -3,7 +3,7 @@
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import ITTTBReconhecimentoTipo from '../../_interfaces/TTBReconhecimentoTipoInterface'
import TTBReconhecimentoTipoSaveData from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData";
import { TTBReconhecimentoTipoSaveData } from "../../_data/TTBReconhecimentoTipo/TTBReconhecimentoTipoSaveData";
export const useTTBReconhecimentoTipoSaveHook = () => {