feat: 用户登录使用mock api, 可以使用test用户登录 (#233)

* feat: 用户登录使用mock api, 可以使用test用户登录

* Update permission.ts
This commit is contained in:
tomoat
2022-04-07 22:47:33 +08:00
committed by GitHub
parent bafd9522e0
commit 0becf0b4bc
5 changed files with 48 additions and 14 deletions

23
mock/user.ts Normal file
View File

@@ -0,0 +1,23 @@
import { MockMethod } from "vite-plugin-mock";
export default [
{
url: "/login",
method: "post",
response: ({ body }) => {
if (body.username === "admin") {
return {
username: "admin",
expires: 24 * 60 * 60,
accessToken: "eyJhbGciOiJIUzUxMiJ9.admin"
};
} else {
return {
username: "test",
expires: 24 * 60 * 60,
accessToken: "eyJhbGciOiJIUzUxMiJ9.test"
};
}
}
}
] as MockMethod[];