1 回答

TA貢獻(xiàn)1826條經(jīng)驗(yàn) 獲得超6個(gè)贊
登錄獲取token
this.$http.get(Util.DataInterface + '/api/auth', {
params: quseDataNow,
emulateJSON: true
}).then((response) => {
localStorage.setItem('token', response.data.data.token);
}, (response) => {
console.log("error: ", response);
});
獲取到token以后每次請(qǐng)求接口都帶上
headers: {
Authorization: localStorage.getItem("token")
},
this.$http.get(Util.DataInterface + '/api/ranking/platform', {
headers: {
Authorization: localStorage.getItem("token")
},
params: quesDataNow,
emulateJSON: true
}).then((response) => {
this.tableList = response.data;
$('#sortTable').DataTable().destroy();
this.tableLoad();
}, (response) => {
// error callback
if (response.status === 401) {
Util.init();
}
});
添加回答
舉報(bào)