index.mock.ts 1.1 KB

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