diff --git a/src/actions/json/Json.ts b/src/actions/json/Json.ts index 92a1a18..b075b64 100644 --- a/src/actions/json/Json.ts +++ b/src/actions/json/Json.ts @@ -1,16 +1,6 @@ +import appConfig from '../../config/app.json'; export default class Json { - - static execute(path: string) { - - return { - "state": "go", - "api": { - "url": "http://localhost:8000/", - "prefix": "api/v1", - "content_type": "application/json" - } - } - + static execute() { + return appConfig; } - } \ No newline at end of file diff --git a/src/config/app.json b/src/config/app.json index 64ba493..d38e8d3 100644 --- a/src/config/app.json +++ b/src/config/app.json @@ -1,7 +1,7 @@ { "state": "go", "api": { - "url": "http://localhost:3000/", + "url": "http://localhost:8000/", "prefix": "api/v1/", "content_type": "application/json" } diff --git a/src/services/api/Api.ts b/src/services/api/Api.ts index 75e6173..6e21132 100644 --- a/src/services/api/Api.ts +++ b/src/services/api/Api.ts @@ -17,7 +17,7 @@ export default class API { this.ApiSchema = new ApiSchema(); // Obtem as configurações da aplicação - this.config = Json.execute('config/app.json'); + this.config = Json.execute(); } @@ -46,7 +46,7 @@ export default class API { const filteredBody = _data.body ? Object.fromEntries(Object.entries(_data.body).filter(([_, v]) => v != null && v !== "")) : null; // Realiza a requisição - const response = await fetch(`${this.ApiSchema.url}${this.ApiSchema.prefix}/${this.ApiSchema.endpoint}`, { + const response = await fetch(`${this.ApiSchema.url}${this.ApiSchema.prefix}${this.ApiSchema.endpoint}`, { method: _data.method, headers: { "Accept": `${this.ApiSchema.contentType}`,