Compare commits

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

1 commit

Author SHA1 Message Date
=
ac49c86f53 refactor(geral): implementando gerenciador de erro nos datas 2025-09-29 09:49:58 -03:00
9 changed files with 36 additions and 18 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 GTBProfissoesIndexData() {
async function executeGTBProfissoesIndexData() {
const api = new API();
@ -9,4 +10,6 @@ export default async function GTBProfissoesIndexData() {
method: Methods.GET,
endpoint: `administrativo/g_tb_profissao/`
});
}
}
export const GTBProfissoesIndexData = withClientErrorHandler(executeGTBProfissoesIndexData)

View file

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

View file

@ -1,8 +1,9 @@
import API from "@/services/api/Api";
import GTBProfissaoInterface from "../../_interfaces/GTBProfissaoInterface";
import { Methods } from "@/services/api/enums/ApiMethodEnum";
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
export default async function GTBProfissaoSaveData(data: GTBProfissaoInterface) {
async function executeGTBProfissaoSaveData(data: GTBProfissaoInterface) {
const isUpdate = Boolean(data.tb_profissao_id);
@ -14,4 +15,6 @@ export default async function GTBProfissaoSaveData(data: GTBProfissaoInterface)
body: data
});
}
}
export const GTBProfissaoSaveData = withClientErrorHandler(executeGTBProfissaoSaveData)

View file

@ -1,7 +1,7 @@
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import GTBProfissaoInterface from "../../_interfaces/GTBProfissaoInterface";
import GTBProfissaoIndexService from "../../_services/g_tb_profissao/GTBProfissaoIndexService";
import { GTBProfissaoIndexService } from "../../_services/g_tb_profissao/GTBProfissaoIndexService";
export const useGTBProfissaoReadHook = () => {

View file

@ -1,6 +1,6 @@
import { useResponse } from "@/app/_response/ResponseContext"
import GTBProfissaoInterface from "../../_interfaces/GTBProfissaoInterface";
import GTBProfissaoRemoveService from "../../_services/g_tb_profissao/GTBProfissaoRemoveService";
import { GTBProfissaoRemoveService } from "../../_services/g_tb_profissao/GTBProfissaoRemoveService";
export const useGTBProfissaoRemoveHook = () => {

View file

@ -1,7 +1,7 @@
import { useResponse } from "@/app/_response/ResponseContext"
import { useState } from "react";
import GTBProfissaoInterface from "../../_interfaces/GTBProfissaoInterface";
import GTBProfissaoSaveService from "../../_services/g_tb_profissao/GTBProfissaoSaveService";
import { GTBProfissaoSaveService } from "../../_services/g_tb_profissao/GTBProfissaoSaveService";
export const useGTBProfissaoSaveHook = () => {

View file

@ -1,9 +1,12 @@
import GTBProfissoesIndexData from "../../_data/GTBProfissao/GTBProfissaoIndexData";
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
import { GTBProfissoesIndexData } from "../../_data/GTBProfissao/GTBProfissaoIndexData";
export default async function GTBProfissaoIndexService() {
async function executeGTBProfissaoIndexService() {
const response = await GTBProfissoesIndexData();
return response;
}
}
export const GTBProfissaoIndexService = withClientErrorHandler(executeGTBProfissaoIndexService)

View file

@ -1,10 +1,13 @@
import GTBProfissaoRemoveData from "../../_data/GTBProfissao/GTBProfissaoRemoveData";
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
import { GTBProfissaoRemoveData } from "../../_data/GTBProfissao/GTBProfissaoRemoveData";
import GTBProfissaoInterface from "../../_interfaces/GTBProfissaoInterface";
export default async function GTBProfissaoRemoveService(data: GTBProfissaoInterface) {
async function executeGTBProfissaoRemoveService(data: GTBProfissaoInterface) {
const response = await GTBProfissaoRemoveData(data);
return response;
}
}
export const GTBProfissaoRemoveService = withClientErrorHandler(executeGTBProfissaoRemoveService)

View file

@ -1,7 +1,8 @@
import GTBProfissaoSaveData from "../../_data/GTBProfissao/GTBProfissaoSaveData";
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
import { GTBProfissaoSaveData } from "../../_data/GTBProfissao/GTBProfissaoSaveData";
import GTBProfissaoInterface from "../../_interfaces/GTBProfissaoInterface";
export default async function GTProfissaoSaveService(data: GTBProfissaoInterface) {
async function executeGTBProfissaoSaveService(data: GTBProfissaoInterface) {
const response = await GTBProfissaoSaveData(data);
@ -9,4 +10,6 @@ export default async function GTProfissaoSaveService(data: GTBProfissaoInterface
return response;
}
}
export const GTBProfissaoSaveService = withClientErrorHandler(executeGTBProfissaoSaveService)