думав, що там усе правильно (може воно так і є)
                  
                  
                      requestMethodPost(url, data) {
                  
                  
                          // Default options are marked with *
                  
                  
                          // const fullUrl = config.apiConfig[site].url + url;
                  
                  
                          const xsrf = this.getXsrfToken();
                  
                  
                          const fullUrl = 'http://localhost:8012/api/v2/' + url;
                  
                  
                          return fetch(fullUrl, {
                  
                  
                              method: 'POST', // *GET, POST, PUT, DELETE, etc.
                  
                  
                              mode: 'no-cors', // no-cors, *cors, same-origin
                  
                  
                              cache: 'no-cache', // *default, no-cache, reload, force-cache, only-if-cached
                  
                  
                              credentials: 'same-origin', // include, *same-origin, omit
                  
                  
                              headers: {
                  
                  
                                  'Content-Type': 'application/json',
                  
                  
                                  'X-XSRF-TOKEN': xsrf,
                  
                  
                                  // 'Content-Type': 'application/x-www-form-urlencoded',
                  
                  
                              },
                  
                  
                              redirect: 'follow', // manual, *follow, error
                  
                  
                              referrerPolicy: 'no-referrer', // no-referrer, *no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url
                  
                  
                              body: JSON.stringify(data) // body data type must match "Content-Type" header
                  
                  
                          }).then(res => res.json()); // parses JSON response into native JavaScript objects
                  
                  
                      }
                  
                  
                  Зараз ЖС лається на строчку де fetch і не хоче далі працювати.
                  
                  
                  Помилку пише так:
                  
                  
                  "Uncaught (in promise) SyntaxError: Unexpected end of input"
                  
                  
                  
                  
                  
                  Подивіться будь ласка код, може дасте пораду - що тут виправити?
                  
                  
                
Глянь в хроме Network таб что API эндпойнит возвращает. Похоже что никакой не JSON.
Обсуждают сегодня