refactor(geral): implementando gerenciador de erro nos datas
This commit is contained in:
parent
eeab66149f
commit
90b2d4ef53
9 changed files with 36 additions and 18 deletions
|
|
@ -1,8 +1,9 @@
|
|||
import API from "@/services/api/Api";
|
||||
import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface";
|
||||
import { Methods } from "@/services/api/enums/ApiMethodEnum";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
|
||||
export default async function GTBRegimeComunhaoIndexData() {
|
||||
async function executeGTBRegimeComunhaoIndexData() {
|
||||
|
||||
const api = new API();
|
||||
|
||||
|
|
@ -11,4 +12,6 @@ export default async function GTBRegimeComunhaoIndexData() {
|
|||
endpoint: `administrativo/g_tb_regimecomunhao/`
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const GTBRegimeComunhaoIndexData = withClientErrorHandler(executeGTBRegimeComunhaoIndexData)
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
import API from "@/services/api/Api";
|
||||
import { Methods } from "@/services/api/enums/ApiMethodEnum";
|
||||
import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
|
||||
export default async function GTBRegimeComunhaoRemoveData(data: GTBRegimeComunhaoInterface) {
|
||||
async function executeGTBRegimeComunhaoRemoveData(data: GTBRegimeComunhaoInterface) {
|
||||
|
||||
const api = new API();
|
||||
|
||||
|
|
@ -11,4 +12,6 @@ export default async function GTBRegimeComunhaoRemoveData(data: GTBRegimeComunha
|
|||
endpoint: `administrativo/g_tb_regimecomunhao/${data.tb_regimecomunhao_id}`
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const GTBRegimeComunhaoRemoveData = withClientErrorHandler(executeGTBRegimeComunhaoRemoveData)
|
||||
|
|
@ -1,8 +1,9 @@
|
|||
import API from "@/services/api/Api";
|
||||
import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface";
|
||||
import { Methods } from "@/services/api/enums/ApiMethodEnum";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
|
||||
export default async function GTBRegimeComunhaoSaveData(data: GTBRegimeComunhaoInterface) {
|
||||
async function executeGTBRegimeComunhaoSaveData(data: GTBRegimeComunhaoInterface) {
|
||||
|
||||
const isUpdate = Boolean(data.tb_regimecomunhao_id);
|
||||
|
||||
|
|
@ -13,4 +14,6 @@ export default async function GTBRegimeComunhaoSaveData(data: GTBRegimeComunhaoI
|
|||
endpoint: `administrativo/g_tb_regimecomunhao/${data.tb_regimecomunhao_id || ''}`,
|
||||
body: data
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export const GTBRegimeComunhaoSaveData = withClientErrorHandler(executeGTBRegimeComunhaoSaveData)
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
import { useResponse } from "@/app/_response/ResponseContext"
|
||||
import { useState } from "react";
|
||||
import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface";
|
||||
import GTBRegimeComunhaoIndexService from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoIndexService";
|
||||
import { GTBRegimeComunhaoIndexService } from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoIndexService";
|
||||
|
||||
export const useGTBRegimeComunhaoReadHook = () => {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { useResponse } from "@/app/_response/ResponseContext"
|
||||
import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface";
|
||||
import GTBRegimeComunhaoRemoveService from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoRemoveService";
|
||||
import { GTBRegimeComunhaoRemoveService } from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoRemoveService";
|
||||
|
||||
export const useGTBRegimeComunhaoRemoveHook = () => {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
import { useState } from "react";
|
||||
import { useResponse } from "@/app/_response/ResponseContext"
|
||||
import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface";
|
||||
import GTBRegimeComunhaoSaveService from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoSaveService";
|
||||
import { GTBRegimeComunhaoSaveService } from "../../_services/g_tb_regimecomunhao/GTBRegimeComunhaoSaveService";
|
||||
|
||||
export const useGTBRegimeComunhaoSaveHook = () => {
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
import GTBRegimeComunhaoIndexData from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoIndexData";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
import { GTBRegimeComunhaoIndexData } from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoIndexData";
|
||||
|
||||
export default async function GTBRegimeComunhaoIndexService() {
|
||||
async function executeGTBRegimeComunhaoIndexService() {
|
||||
|
||||
const response = await GTBRegimeComunhaoIndexData();
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const GTBRegimeComunhaoIndexService = withClientErrorHandler(executeGTBRegimeComunhaoIndexService)
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
import GTBRegimeComunhaoRemoveData from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoRemoveData";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
import { GTBRegimeComunhaoRemoveData } from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoRemoveData";
|
||||
import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface";
|
||||
|
||||
export default async function GTBRegimeComunhaoRemoveService(data: GTBRegimeComunhaoInterface) {
|
||||
async function executeGTBRegimeComunhaoRemoveService(data: GTBRegimeComunhaoInterface) {
|
||||
|
||||
const response = await GTBRegimeComunhaoRemoveData(data);
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const GTBRegimeComunhaoRemoveService = withClientErrorHandler(executeGTBRegimeComunhaoRemoveService)
|
||||
|
|
@ -1,10 +1,13 @@
|
|||
import GTBRegimeComunhaoSaveData from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoSaveData";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
import { GTBRegimeComunhaoSaveData } from "../../_data/GTRegimeComunhao/GTBRegimeComunhaoSaveData";
|
||||
import GTBRegimeComunhaoInterface from "../../_interfaces/GTBRegimeComunhaoInterface";
|
||||
|
||||
export default async function GTBRegimeComunhaoSaveService(data: GTBRegimeComunhaoInterface) {
|
||||
async function executeGTBRegimeComunhaoSaveService(data: GTBRegimeComunhaoInterface) {
|
||||
|
||||
const response = await GTBRegimeComunhaoSaveData(data);
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const GTBRegimeComunhaoSaveService = withClientErrorHandler(executeGTBRegimeComunhaoSaveService)
|
||||
Loading…
Add table
Reference in a new issue