This repository has been archived on 2026-10-10. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
a_sink_repair/scripts/dataAccess.js
T
2021-11-04 10:30:22 -05:00

34 lines
873 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}))
}
export const getEmployees = () => {
return database.employeeTable.map(employee => ({...employee}))
}
export const getJobTable = () => {
return database.jobTable.map(job => ({...job}))
}
// Need copies of permanent state set as empty arrays, matching the keys in your JSON file
const serviceRequest = []
const employeeTable = []
const jobTable = []
const requests = []
const appState = []