viewActions.ts 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. import axios from 'axios';
  2. export interface View {
  3. internal_id: string;
  4. view_id: string;
  5. view_name: string;
  6. view_name_local: string;
  7. view_other_name: string;
  8. view_description: string;
  9. view_position: string;
  10. application: string;
  11. anatomic_region: string;
  12. patient_type: string;
  13. body_part_id: string;
  14. view_icon_name: string;
  15. view_big_icon_name: string;
  16. view_coach_name: string;
  17. modality: string;
  18. work_station_id: number;
  19. apr_id: string;
  20. img_proc_id: string;
  21. // config_object: any;
  22. sort: number;
  23. is_enabled: boolean;
  24. product: string;
  25. is_pre_install: boolean;
  26. procedure_id?: string;
  27. }
  28. interface FetchViewsResponse {
  29. code: string;
  30. description: string;
  31. solution: string;
  32. data: {
  33. '@type': string;
  34. view_list: View[];
  35. };
  36. }
  37. export const fetchViews = async (
  38. patient_type: string | null,
  39. body_part: string | null,
  40. is_enabled: boolean,
  41. procedure_id: string | null | undefined
  42. ): Promise<FetchViewsResponse> => {
  43. const response = await axios.get('/dr/api/v1/auth/protocol/view', {
  44. //todo get header info
  45. // authorization: string,
  46. // language: 'en' | 'zh',
  47. // product: 'DROS' | 'VETDROS',
  48. // source: 'Electron' | 'Browser' | 'Android'
  49. headers: {
  50. Authorization:
  51. 'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NTEyNzc5NzAsImlkIjoxLCJuYW1lIjoiYWRtaW4ifQ.ooTGwBXaNhtunbKbpqteWbjDwJLjnRmSIl80r5dp1pY',
  52. Language: 'en',
  53. Product: 'DROS',
  54. Source: 'Electron',
  55. },
  56. params: {
  57. patient_type,
  58. body_part,
  59. is_enabled,
  60. procedure_id,
  61. },
  62. });
  63. return response.data;
  64. };