index.ts 674 B

1234567891011121314151617181920212223242526272829
  1. import invokeApi from '../helpers/apiHelpers';
  2. import apiPath from '../constants/apiPath';
  3. import config from '../config';
  4. export const initialPdfFile = async (token: string): Promise<unknown> =>
  5. invokeApi({
  6. path: apiPath.initPdf,
  7. method: 'GET',
  8. data: {
  9. f: token,
  10. },
  11. });
  12. export const saveFile = async (
  13. token: string,
  14. data: Record<string, unknown>,
  15. ): Promise<unknown> =>
  16. invokeApi({
  17. path: `${apiPath.saveFile}?f=${token}`,
  18. method: 'POST',
  19. data,
  20. });
  21. export const fetchXfdf = (token: string): Promise<string> =>
  22. fetch(`${config.API_HOST}${apiPath.getXfdf}?f=${token}`).then((res) =>
  23. res.text(),
  24. );
  25. export default {};