0

Part of existing code

    let xhr = new XMLHttpRequest(),
    xhr.onreadystatechange = () => {
        if(xhr.readyState == 4) {
            if(xhr.status >= 200 && xhr.status < 300)
                this.onUpload.emit({xhr: xhr, files: this.files});
            else
                this.onError.emit({xhr: xhr, files: this.files});
        }
    };

I'd like to change this code to emit object of type Response. So I need to convert XMLHttpRequest to Response. Is there any ready way to do this or should I write it myself?

koral
  • 2,807
  • 3
  • 37
  • 65

0 Answers0