
let globalVars={
    getToken:function(){    //promise
        return new Promise(function(resolve,reject){
            if ($.cookie('token')){resolve($.cookie('token'));return;}
            axios.get(window.urls.token).then(function (response) {
                if (response.data.result==null||response.data.result==='failure'){
                    alert('尚未登录，请登录后重试');
                    return ''
                }
                let token=response.data.token
                $.cookie('token',token)
                resolve(token)
            }).catch(function (error) {
                reject("get Token error:"+error)
            })

        })
    },
};
module.exports=globalVars;
