Executando verificação de segurança...
1

Olá Gabriel! obrigado pelo seu post. Me ajudou demais até aqui. Só estou com um problema em uma aplicação, talvez você possa me ajudar. Ao pegar os dados com o axios me retona o seguinte problema no console:

Access to XMLHttpRequest at '<https://www.tabnews.com.br/api/v1/contents/jairotunisse?page=1&strategy=relevant>' from origin '<http://localhost:5173>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

E continua com alguns erros:

`
https://www.tabnews.com.br/api/v1/contents/jairotunisse?page=1&strategy=relevant net::ERR_FAILED 429 (Too Many Requests)

xhr.js:163 Uncaught (in promise)
AxiosError {message: 'Network Error', name: 'AxiosError', code: 'ERR_NETWORK', config: {…}, request: XMLHttpRequest, …}
fetchPosts @ index.tsx:39
await in fetchPosts (async)
(anonymous) @ index.tsx:43
Show 11 more frames
`

Meu código ficou assim:

`
async function fetchPosts() {
const response = await tabnews.get("contents/jairotunisse", {
params: {
page: 1,
strategy: "relevant",
},
});

const result = response.data.filter((post: any) => post.parent_id === null); // Para procurar somente meu post.

setPosts(result);

}

`

Estou consumindo a api com o axios e rodando o projeto com o vite. Sabe o que pode ser? Desde já muito obrigado.

0