index.ts 1005 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { invalidateCache } from 'alova';
  2. import HTTP from '@/request/alova';
  3. import { application } from '@/request/model';
  4. import { getPinia, usePlatformStore } from '@/stores';
  5. export * from './account.api';
  6. export * from './questionnaire.api';
  7. export * from './report.api';
  8. export function getApplicationMethod() {
  9. return HTTP.Post(`/fdhb-tablet/warrantManage/getPageSets`, void 0, {
  10. cacheFor,
  11. shareRequest: true,
  12. transform: application,
  13. });
  14. }
  15. export function toggleApplicationMethod() {
  16. const pinia = getPinia();
  17. const warrant = usePlatformStore(pinia).serialNumber ?? '';
  18. return HTTP.Post(
  19. `/fdhb-tablet/warrantManage/updateWarrant`,
  20. { warrant },
  21. {
  22. cacheFor: null,
  23. async transform() {
  24. await invalidateCache();
  25. const store = (pinia as any)._s as Map<string, { $reset?: () => void }>;
  26. for (const [key, value] of store) if (key !== 'platform') value.$reset?.();
  27. },
  28. }
  29. );
  30. }
  31. export const cacheFor = 24 * 60 * 60 * 1000;