-1
I am doing my first course of Reset with Xios and found problems making get calls. The relevant code is: api.js:
import axios from "axios";
const api = axios.create({
baseURL: "https://192.168.15.8:3333",
});
export default api;
index js.:
async function loadIncidents() {
if (loading) {
return;
}
if (total > 0 && incidents.length === total) {
return;
}
setLoading(true);
const response = await api.get("incidents", {
params: { page },
});
setIncidents([...incidents, ...response.data]);
setTotal(response.headers["x-total-count"]);
setPage(page + 1);
setLoading(false);
}
The mistake is:
in that part
const response = await api.get("incidents", {
missing bar, exampleconst response = await api.get("/incidents", {
because if you don’t put it points to the wrong address– novic
I did what you said, keep on making the same mistake
– Yann Le Hyaric Almeida
and it is not possible to know! unfortunately problem that we can not reproduce
– novic