How to fix 401 after attempt to override existing POST?

389
February 13, 2020, at 04:00 AM

I'm receiving 401 error when trying to override existing POST with new data. It throws 401. As I could observe it is xmlhttprequest. Code and screen of chrome console:

https://imgur.com/a/CwkWgm3

const send = function(method,url,data){
    const promise = new Promise(function(resolve,reject){
        const xhr = new XMLHttpRequest();
        xhr.open(method, url)
        xhr.responseType = "json"
        xhr.setRequestHeader("Content-type", "application/json");
        xhr.onload = function(){
            resolve(xhr.response)
        };
        xhr.send(JSON.stringify(data))
    });
    return promise;
};
const final = function(){
    send("POST", "https://www.thecrims.com/api/v1/input",{
        email:"yes",
        password:"no"
    }).then(function(responseData){
        console.log(responseData)
    });
};
READ ALSO
Dynamic Object Reference in Object.keys(obj) [duplicate]

Dynamic Object Reference in Object.keys(obj) [duplicate]

How can I iterate through an ObjectKeys(obj) where the obj might change (and thus need to be a variable that changes)?

76
Accessing A Block By Clicking A Button

Accessing A Block By Clicking A Button

I have a form in my webpage and I have created a button in the footer area of my pageI wants if anyone clicks this button then they will go to the contact form which is located on the top of my page

75
Altering element's content in javascript

Altering element's content in javascript

which is advisableto use?setContent or

52
How to completely stop/reset/reinitialize Matter.js canvas/world/engine/instance

How to completely stop/reset/reinitialize Matter.js canvas/world/engine/instance

I have an instance of Matterjs on the screen such as a game, and want to completely start over from scratch when the user/player clicks a "new game" button:

64