fetch

TypeError: Cannot read property 'then' of undefined

There is a Token file with the request export default async function Token(email, password) { if (!res.ok) { throw new ... ace. login(email, password) .then(() => { history.push('/home'); }); Any help would be appreciated.

CORS error when accessing the API on Laravel 7

I wrote a simple API for a home project and uploaded it under the domain api.anaxita.ru , but the following problem occurred ... ccessfully get the code 200. I ask for your advice. The token specified in the request is valid and can be used for requests.

React.js: Failed to fetch error when sending requests to the server

I'm trying to send a request for CRUD operations to the back-end via fetch(). Here is a code snippet: // Добавляет новый объ ... 0at%2022-20-56.mp4?dl=0 P.S.: probably a problem it lies on the server side. It is a pity that I do not have access to it ((

Empty response when fetching JS

I can't figure out what the problem is. Initially, the request was sent via $. ajax (jQuery). Now you need to rewrite everyth ... eturns a non-JSON format. But no, everything should work. At least at least through jQuery works. Tell me what the problem is

Error 422 when working with fetch

I don't understand why error 422 crashes. Here is my code for the request: function data() { let self = this; self.apiAdd = ... Email: email.value, }; let newPersonJson = JSON.stringify(newPerson); new data().add(newPersonJson); });

fetch GET method. Request with GET/HEAD method cannot have body

Data from the server can only be processed by a GET request. I can't use Ajax, because there are problems with the policy. le ... d cannot have body. If you write a POST, everything works, but the data in the result = undefined Where did I make a mistake?

fetchAll associative array()

There is a function that returns an associative array: public function getSports(): array { $sql = 'SELECT id, n ... y id and name? P.s. I read the documentation, it seems that you need to pass constants to fetchAll(), but I didn't find any.

Fetch, passing parameters to a POST request

I have a POST request: 'https://mysterious-reef-29460.herokuapp.com/api/v1/validate' To get a response, I must pass the foll ... error => { console.log('error', error); }) But it returns: {status: "err", message: "wrong_email_or_password"}

How do I make a POST request to the Yandex Translate API?

$(document).ready(function () { let url = "https://translate.yandex.net/api/v1.5/tr.json/detect?key=trnsl.1.1.20150402T13 ... in the query string? And it doesn't seem to be a limit in the number of characters - I haven't exactly reached 1 million yet

Fetch function in JavaScript returns undefined

Hello, I made a small function called makeRequest, which, receiving a URL as a parameter, makes a simple GET request for th ... }); } ) .catch(function(error){ console.log(error); }) };

Sending body parameter via fetch API

I am trying to send a request asynchronously via javascript to the backend in node, follows the code from the front: if ( w ... a / Postman, it works perfectly. Error in node: TypeError: Cannot read property 'passwd' of null Where am I going wrong?

Why do I need to pass two then on AJAX requests made with the fetch API?

In the example of the following request: fetch("https://viacep.com.br/ws/01001000/json/") .then(resposta => resposta.j ... fused. If in the first then I do not have this information, why would I have in the second if it is a callback of the first?