Archived
18 lines
563 B
JavaScript
18 lines
563 B
JavaScript
const API = "http://localhost:8088"
|
|
|
|
export const fetchRequests = () => {
|
|
return fetch(`${API}/requests`)
|
|
.then(response => response.json())
|
|
.then(
|
|
(serviceRequests) => {
|
|
// Store the external state in application state
|
|
applicationState.requests = serviceRequests
|
|
}
|
|
)
|
|
}
|
|
|
|
export const getRequests = () => {
|
|
return database.serviceRequest.map(serviceRequest => ({...serviceRequest}))
|
|
}
|
|
|
|
// Need copies of permanent state set as empty arrays, matching the keys in your JSON file
|