2022-04-08 12:05:46 +08:00

24 lines
511 B
TypeScript

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[];