{
                  
                  
                      requestWrapper(url, options) {
                  
                  
                          return new Promise((resolve, reject) => {
                  
                  
                              let xhr = new XMLHttpRequest();
                  
                  
                              xhr.open(options.method || 'GET', url, false);
                  
                  
                              xhr.onreadystatechange = function () {
                  
                  
                                  if (xhr.status !== 200)
                  
                  
                                      reject('Ошибка сервера: ' + this.status);
                  
                  
                              };
                  
                  
                              xhr.setRequestHeader('Content-Type', 'application/json;charset=UTF-8');
                  
                  
                              xhr.onload = () => {
                  
                  
                                  resolve('response' in xhr ? xhr.response : xhr.responseText);
                  
                  
                              };
                  
                  
                              xhr.onerror = (xhr, err) => {
                  
                  
                                  reject(err);
                  
                  
                              };
                  
                  
                              xhr.send(JSON.stringify(options.data));
                  
                  
                          });
                  
                  
                      },
                  
                  
                  };
                  
                  
                
xhr неудобный. И он и есть аякс лол
Обсуждают сегодня