Skip to content
This repository was archived by the owner on Mar 3, 2019. It is now read-only.
This repository was archived by the owner on Mar 3, 2019. It is now read-only.

API client must have associated test #53

Open
@lykmapipo

Description

@lykmapipo

const API_END_POINT = 'https://emis-asat.herokuapp.com/v1';
const API = {
findStakeholders: () => {
return fetch(`${API_END_POINT}/parties`).then(res => res.json());
},
searchStakeholder: searchText => {
return fetch(`${API_END_POINT}/parties?q=${searchText}`)
.then(res => res.json())
},
createStakeholder: data => {
const url = `${API_END_POINT}/parties`;
const config = {
method: 'POST',
body: JSON.stringify(data),
headers: {
'content-type': 'application/json'
}
};
return fetch(url, config).then(res => res.json());
},
updateStakeholder: (stakeholderId, updates) => {
const url = `${API_END_POINT}/parties/${stakeholderId}`;
const config = {
method: 'PATCH',
body: JSON.stringify(updates),
headers: {
'content-type': 'application/json'
}
};
return fetch(url, config).then(res => res.json());
}
};
export default API;

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions