index.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. import config from '@/config/axios/config'
  2. import { MockMethod } from 'vite-plugin-mock'
  3. const timeout = 600000
  4. const { code } = config
  5. export default [
  6. {
  7. url: '/request/1',
  8. method: 'get',
  9. timeout,
  10. response: () => {
  11. return {
  12. code: code,
  13. data: 'request-1'
  14. }
  15. }
  16. },
  17. {
  18. url: '/request/2',
  19. method: 'get',
  20. timeout,
  21. response: () => {
  22. return {
  23. code: code,
  24. data: 'request-2'
  25. }
  26. }
  27. },
  28. {
  29. url: '/request/3',
  30. method: 'get',
  31. timeout,
  32. response: () => {
  33. return {
  34. code: code,
  35. data: 'request-3'
  36. }
  37. }
  38. },
  39. {
  40. url: '/request/4',
  41. method: 'get',
  42. timeout,
  43. response: () => {
  44. return {
  45. code: code,
  46. data: 'request-4'
  47. }
  48. }
  49. },
  50. {
  51. url: '/request/5',
  52. method: 'get',
  53. timeout,
  54. response: () => {
  55. return {
  56. code: code,
  57. data: 'request-5'
  58. }
  59. }
  60. },
  61. {
  62. url: '/request/expired',
  63. method: 'get',
  64. timeout: 0,
  65. response: () => {
  66. return {
  67. code: 401,
  68. message: 'token expired'
  69. }
  70. }
  71. }
  72. ] as MockMethod[]