feat(projects): 抽离部分登陆逻辑,支持Token或JWT校验方式

This commit is contained in:
樱吹雪
2023-01-20 09:56:12 +08:00
parent 34ffd9c1f3
commit 34fcf4ca26
6 changed files with 109 additions and 56 deletions

View File

@@ -23,7 +23,7 @@ const apis: MockMethod[] = [
{
url: '/mock/login',
method: 'post',
response: (options: Service.MockOption): Service.MockServiceResult<ApiAuth.Token | null> => {
response: (options: Service.MockOption): Service.MockServiceResult<ApiAuth.JWT | null> => {
const { userName = undefined, password = undefined } = options.body;
if (!userName || !password) {
@@ -101,7 +101,7 @@ const apis: MockMethod[] = [
{
url: '/mock/updateToken',
method: 'post',
response: (options: Service.MockOption): Service.MockServiceResult<ApiAuth.Token | null> => {
response: (options: Service.MockOption): Service.MockServiceResult<ApiAuth.JWT | null> => {
const { refreshToken = '' } = options.body;
const findItem = userModel.find(item => item.refreshToken === refreshToken);