The question of Promise resolve

how to reset resolve or Promise after the first resolve so that the next resolve has output

I am writing login operations, and sometimes I encounter login failures. You need to reset resolve or Promise, so that you can have resolve when you initiate a login request again

however, after the first resolve, the second time and more, you can no longer resolve.

.

how do I reset resolve/Promise?

Aug.02,2021

function test(){
  return new Promise(function(resolve){
    setTimeout(function(){
      resolve()
    })
  })
}

test().then(...)

let p;
    function login(isSuccess){
        if(!p){
            var d=new Promise((resolve,reject)=>{
                isSuccess?resolve():reject();
            });
            d.then(()=>p=d);
            return d;
        }
        return p;
    }
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b30fc4-2b4d6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b30fc4-2b4d6.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?