actionRootCats.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import { gql } from "../helpers";
  2. import { actionPromise } from "../reducers";
  3. export const actionRootCats = () =>
  4. actionPromise(
  5. "rootCats",
  6. gql(
  7. `query rootCats($query:String) {
  8. CategoryFind(query: $query){
  9. _id name
  10. }
  11. }`,
  12. {
  13. query: JSON.stringify([
  14. {
  15. parent: null,
  16. },
  17. ]),
  18. }
  19. )
  20. );
  21. // () => ({
  22. // data: [
  23. // {
  24. // id: 1,
  25. // name: 'Categoty 1',
  26. // },
  27. // {
  28. // id: 2,
  29. // name: 'Categoty 2',
  30. // },
  31. // {
  32. // id: 3,
  33. // name: 'Categoty 3',
  34. // },
  35. // {
  36. // id: 4,
  37. // name: 'Categoty 4',
  38. // },
  39. // ],
  40. // }),
  41. // .then((data) => {
  42. // if (data.errors) {
  43. // throw new Error(JSON.stringify(data.errors));
  44. // } else return Object.values(data.data)[0];
  45. // })
  46. // fetch(backendURL + "/api/reception/patient/", {
  47. // method: "GET",
  48. // headers: {
  49. // "Content-Type": "application/json",
  50. // ...(localStorage.authToken ? { Authorization: "Bearer " + localStorage.authToken } : {}),
  51. // },
  52. // });
  53. // actionPromise("patientAll", fetch(url, {
  54. // type:"GET",
  55. // headers: {
  56. // "Content-Type": "application/json",
  57. // ...(localStorage.authToken ? { Authorization: "Bearer " + localStorage.authToken } : {}),
  58. // },
  59. // body: data,
  60. // })
  61. // .then((res) => res.json())
  62. // .then((data) => {
  63. // if (typeof data === "string") {
  64. // throw new Error(data);
  65. // } else return Object.values(data);
  66. // }))