Compare commits
1 commit
| Author | SHA1 | Date | |
|---|---|---|---|
| db359d12bc |
3 changed files with 6 additions and 16 deletions
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"state": "go",
|
||||
"api": {
|
||||
"url": "http://localhost:3000/",
|
||||
"url": "http://localhost:8000/",
|
||||
"prefix": "api/v1/",
|
||||
"content_type": "application/json"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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}`,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue