You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
511 B

  1. import { MockMethod } from "vite-plugin-mock";
  2. export default [
  3. {
  4. url: "/login",
  5. method: "post",
  6. response: ({ body }) => {
  7. if (body.username === "admin") {
  8. return {
  9. username: "admin",
  10. expires: 24 * 60 * 60,
  11. accessToken: "eyJhbGciOiJIUzUxMiJ9.admin"
  12. };
  13. } else {
  14. return {
  15. username: "test",
  16. expires: 24 * 60 * 60,
  17. accessToken: "eyJhbGciOiJIUzUxMiJ9.test"
  18. };
  19. }
  20. }
  21. }
  22. ] as MockMethod[];