drawing.ts 941 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. import { sendFetch, PageProps } from './index'
  2. import * as URL from "./URL";
  3. import {
  4. PolygonsAttrib,
  5. } from "./type";
  6. //
  7. export type PolyDataType = {
  8. id: string
  9. lineIds: string[]
  10. name?: string
  11. }
  12. export interface DrawingDataType extends PolygonsAttrib {
  13. id?: string;
  14. polygons: PolyDataType[],
  15. }
  16. export type DrawingParamsType = {
  17. data: DrawingDataType,
  18. relicsId: string
  19. drawingId?: string
  20. }
  21. export const addOrUpdateDrawingFetch = (params: Partial<DrawingParamsType>) =>
  22. sendFetch<PageProps<DrawingDataType>>(URL.addOrUpdateDrawing, {
  23. method: "post",
  24. body: JSON.stringify(params),
  25. });
  26. export const getDrawingDetailFetch = (drawingId: string) =>
  27. sendFetch<PageProps<DrawingParamsType>>(
  28. URL.getDrawingInfoByRelicsId,
  29. { method: "post", body: JSON.stringify({}) },
  30. { paths: { drawingId: drawingId } }
  31. );