A
A
adizh2021-12-09 15:30:01
JavaScript
adizh, 2021-12-09 15:30:01

Can't make a request to the server along with headers?

there is an apishka, but I can not make a request for it and return json, Says that failed to fetch.

const getData = () => {
  fetch("https://test-docs.stores.kg/api/categories", {
    method: "GET",
    headers: {
      secretKey: "test_key",
      accept: "application/json "
    }
  })
    .then((res) => res.json())
    .then((res) => console.log(res));
};

getData();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question