[MVPTN-77] refactor(geral): implementando gerenciador de erro, removendo mock de dados e usando o botao de loading
This commit is contained in:
parent
6e80b5409a
commit
46296ec8a9
5 changed files with 14 additions and 17 deletions
|
|
@ -1,9 +1,8 @@
|
|||
import API from "@/services/api/Api";
|
||||
import { GTBEstadoCivilInterface } from "../../_interfaces/GTBEstadoCivilInterface";
|
||||
import { Methods } from "@/services/api/enums/ApiMethodEnum";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
|
||||
async function executeGTBEstadoCivilRemoveData(data: GTBEstadoCivilInterface) {
|
||||
export default async function executeGTBEstadoCivilRemoveData(data: GTBEstadoCivilInterface) {
|
||||
|
||||
const api = new API();
|
||||
|
||||
|
|
@ -12,6 +11,4 @@ async function executeGTBEstadoCivilRemoveData(data: GTBEstadoCivilInterface) {
|
|||
endpoint: `administrativo/g_tb_bairro/${data.tb_estadocivil_id}`
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
export const GTBEstadoCivilRemoveData = withClientErrorHandler(executeGTBEstadoCivilRemoveData)
|
||||
}
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
import API from "@/services/api/Api";
|
||||
import { GTBEstadoCivilInterface } from "../../_interfaces/GTBEstadoCivilInterface";
|
||||
import { Methods } from "@/services/api/enums/ApiMethodEnum";
|
||||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
|
||||
async function executeGTBEstadoCivilSaveData(data: GTBEstadoCivilInterface) {
|
||||
export default async function GTBEstadoCivilSaveData(data: GTBEstadoCivilInterface) {
|
||||
|
||||
const isUpdate = Boolean(data.tb_estadocivil_id);
|
||||
|
||||
|
|
@ -15,6 +14,4 @@ async function executeGTBEstadoCivilSaveData(data: GTBEstadoCivilInterface) {
|
|||
body: data
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
export const GTBEstadoCivilSaveData = withClientErrorHandler(executeGTBEstadoCivilSaveData)
|
||||
}
|
||||
|
|
@ -7,7 +7,6 @@ async function executeGTBEstadoCivilIndexService() {
|
|||
const response = await GTBEstadoCivilIndexData();
|
||||
return response;
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
return error
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,10 +1,13 @@
|
|||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
import GTBEstadoCivilSaveData from "../../_data/GTBEstadoCivil/GTBEstadoCivilSaveData";
|
||||
import { GTBEstadoCivilInterface } from "../../_interfaces/GTBEstadoCivilInterface";
|
||||
|
||||
export default async function GTBEstadoCivilRemoveService(data: GTBEstadoCivilInterface) {
|
||||
async function executeGTBEstadoCivilRemoveService(data: GTBEstadoCivilInterface) {
|
||||
|
||||
const response = await GTBEstadoCivilSaveData(data);
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const GTBEstadoCivilRemoveService = withClientErrorHandler(executeGTBEstadoCivilRemoveService)
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
import { withClientErrorHandler } from "@/actions/withClientErrorHandler/withClientErrorHandler";
|
||||
import GTBEstadoCivilSaveData from "../../_data/GTBEstadoCivil/GTBEstadoCivilSaveData";
|
||||
import { GTBEstadoCivilInterface } from "../../_interfaces/GTBEstadoCivilInterface";
|
||||
|
||||
export default async function GTBEstadoCivilSaveService(data: GTBEstadoCivilInterface) {
|
||||
async function executeGTBEstadoCivilSaveService(data: GTBEstadoCivilInterface) {
|
||||
|
||||
const response = await GTBEstadoCivilSaveData(data);
|
||||
|
||||
console.log('GTBRegimeComunhaoSaveData', response)
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
export const GTBEstadoCivilSaveService = withClientErrorHandler(executeGTBEstadoCivilSaveService)
|
||||
Loading…
Add table
Reference in a new issue