viewApiRequest.ts 589 B

1234567891011121314151617181920212223242526272829
  1. import { defineStore } from "pinia";
  2. export const useViewApiRequestStore = props => {
  3. const { modalUuid } = props;
  4. if (!modalUuid) return null;
  5. return defineStore(`viewApiRequest-${modalUuid}`, {
  6. state: () => ({
  7. requestId: null,
  8. request: {
  9. _id: null,
  10. url: null,
  11. params: {},
  12. results: [],
  13. date: null,
  14. quotaCost: null
  15. },
  16. removeAction: null
  17. }),
  18. actions: {
  19. init({ requestId, removeAction }) {
  20. this.requestId = requestId;
  21. this.removeAction = removeAction;
  22. },
  23. viewApiRequest(request) {
  24. this.request = request;
  25. }
  26. }
  27. })();
  28. };