提交 61ceb2e8 编写于 作者: tony001's avatar tony001

新增应用刷新token逻辑 --- fix3

上级 fec51d81
...@@ -108,7 +108,7 @@ export class Interceptors { ...@@ -108,7 +108,7 @@ export class Interceptors {
axios.interceptors.response.use((response: any) => { axios.interceptors.response.use((response: any) => {
if(response.headers && response.headers['refreshtoken'] && localStorage.getItem('token')){ if(response.headers && response.headers['refreshtoken'] && localStorage.getItem('token')){
this.refreshToken(); this.refreshToken(response);
} }
return response; return response;
}, (error: any) => { }, (error: any) => {
...@@ -184,9 +184,13 @@ export class Interceptors { ...@@ -184,9 +184,13 @@ export class Interceptors {
* 刷新token * 刷新token
* *
* @private * @private
* @param {*} [data={}]
* @memberof Interceptors * @memberof Interceptors
*/ */
private refreshToken():void{ private refreshToken(data:any = {}):void{
if(data && data.config && (data.config.url == "/uaa/refreshToken")){
return;
}
Http.getInstance().post('/uaa/refreshToken',localStorage.getItem('token'),false).then((response: any) => { Http.getInstance().post('/uaa/refreshToken',localStorage.getItem('token'),false).then((response: any) => {
if (response && response.status === 200) { if (response && response.status === 200) {
const data = response.data; const data = response.data;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册