I am trying to call the dummy API from SPFX, but I am getting an error that, Failed to fetch
,
this.context.httpClient
.get("http://dummy.restapiexample.com/api/v1/employees", HttpClient.configurations.v1)
.then((res: HttpClientResponse): Promise<any> => {
alert("");
return res.json();
})
.then((data: any): void => {
alert("");
// processProcess your data here
}, (err: any): void => {
// handleHandle error here
});
Please suggest here..How can I fix this problem?