You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
haoliang-net/frontend/mock/login.ts

25 lines
658 B
TypeScript

import type { MockMethod } from './types'
const mock: MockMethod[] = [
{
url: '/mock-api/admin/login',
method: 'post',
response: (req: any) => {
const { username, password, rememberMe } = req.body
if (username === 'admin' && password === 'admin123') {
return {
code: 0,
message: 'success',
data: {
token: rememberMe ? 'eyJhbGciOiJIUzI1NiJ9.admin.7d' : 'eyJhbGciOiJIUzI1NiJ9.admin.8h',
expiresIn: rememberMe ? 604800 : 28800,
},
}
}
return { code: 40001, message: '用户名或密码错误', data: null }
},
},
]
export default mock