feat(projects): 请求拦截器添加刷新token

This commit is contained in:
Soybean
2022-01-12 19:53:45 +08:00
parent 09c7658c21
commit 839b82ba8b
8 changed files with 213 additions and 126 deletions

View File

@ -58,6 +58,35 @@ const apis: MockMethod[] = [
}
};
}
},
{
url: '/mock/testToken',
method: 'post',
response: (option: any): Service.BackendServiceResult<true | null> => {
if (option.headers?.authorization !== token.token) {
return {
code: 66666,
message: 'token 失效',
data: null
};
}
return {
code: 200,
message: 'ok',
data: true
};
}
},
{
url: '/mock/updateToken',
method: 'post',
response: (): Service.BackendServiceResult<string> => {
return {
code: 200,
message: 'ok',
data: token.token
};
}
}
];