index.ts 646 B

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