jq介面的封裝方法

weixin_45293868發表於2020-12-05

$(function() {
// Authentication & Configuration
var accessToken = $.cookie(‘Abp.AuthToken’);
var myRole = $.cookie(‘Abp.MyRole’);
var apiServer = window.hthrefs; // || ‘http://localhost:5634’;
var appDomain = ‘localhost’;
var expires = 1; // day

$.extend(window, {
Abp: {
env: $.cookie(‘Abp.env’),
accessToken: accessToken,
myRole: myRole,
apiServer: apiServer,
appDomain: appDomain,
expires: expires,
ajax: function(opt) {
return . a j a x . c a l l ( .ajax.call( .ajax.call(, $.extend(opt, {
beforeSend: function(req) { req.setRequestHeader(‘Authorization’, 'Bearer ’ + accessToken) },
}))
},
session: {
user: null,

  },

}

相關文章