Tag:football team

  • Yai request preprocessing script

    Time:2020-10-3

    var token = getToken(); var username = “****”; var password = “****”; if (token === null){ context.promise = getNewToken().then((data) => { //Set the current request token context.query.token = data.token; saveToken(data.token, data.expires) }) }else{ context.promise = new Promise(function(resolve) { context.query.token = token; resolve() }) } function getNewToken(){ return new Promise(function(resolve) { var api = context.utils.axios.post(‘http://’+context.hostname+’/api/admin/login’, { […]