handlers.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { http } from 'msw';
  2. export const handlers = [
  3. // Handler 1: 获取患者类型
  4. http.get('/dr/api/v1/auth/protocol/patient_type', async () => {
  5. // 忽略eslint
  6. // eslint-disable-next-line
  7. return new Response(
  8. JSON.stringify({
  9. code: '0x000000',
  10. description: 'Success',
  11. solution: '',
  12. data: {
  13. patient_type_list: [
  14. {
  15. id: '1',
  16. patient_type_id: 'Human',
  17. patient_type_name: 'Human',
  18. patient_type_local: 'Human',
  19. patient_type_description: 'Human',
  20. sort: 1,
  21. is_enabled: true,
  22. product: 'DROC',
  23. is_pre_install: true,
  24. },
  25. {
  26. id: '2',
  27. patient_type_id: 'SpecialType',
  28. patient_type_name: 'SpecialType',
  29. patient_type_local: 'SpecialType',
  30. patient_type_description: 'SpecialType',
  31. sort: 2,
  32. is_enabled: false,
  33. product: 'DROC',
  34. is_pre_install: true,
  35. },
  36. ],
  37. },
  38. }),
  39. {
  40. status: 200,
  41. headers: { 'Content-Type': 'application/json' },
  42. // Simulate 500ms delay
  43. delay: 500,
  44. }
  45. );
  46. }),
  47. ];