I have a react app that isn't mine (a former employee) and I'm still quite new to react. I need to get the app to work so it retrieves data from a SQL database. At the moment the app can't find a request URL from itself called http://localhost//FleetManagement//Api/Default.aspx?method=GetCustomers
The react app gives the following error:
Or in text:
SyntaxError: Unexpected end of JSON input
(anonymous function)
C:/CodeRacvsolar/react-app/src/App.tsx:201
198 |
199 | api.getCustomers(
200 | (req: XMLHttpRequest) => {
> 201 | let getCustomersResponse: interfaces.GetCustomersResponse = JSON.parse(req.responseText);
202 | ^
203 | this.setState({
204 | data: getCustomersResponse,
View compiled
XMLHttpRequest.req.onreadystatechange
C:/CodeRacvsolar/react-app/src/api/api.tsx:54
51 |
52 | if (req.readyState === XMLHttpRequest.DONE) {
53 | if (onComplete) {
> 54 | onComplete(req)
55 | ^ }
56 | }
57 |