risk.ts 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. export const analyzeInvoices = (params: any) => {
  2. return fetch("/api/risk/decide", {
  3. method: "POST",
  4. headers: {
  5. "Content-Type": "application/json",
  6. Accept: "application/json",
  7. },
  8. body: JSON.stringify(params),
  9. }).then((res) => {
  10. if (!res.ok) {
  11. throw new Error(`HTTP error! status: ${res.status}`);
  12. }
  13. return res.json();
  14. });
  15. };
  16. export const evidenceSearch = (params: any) => {
  17. return fetch("/api/risk/evidence", {
  18. method: "POST",
  19. headers: {
  20. "Content-Type": "application/json",
  21. Accept: "application/json",
  22. },
  23. body: JSON.stringify(params),
  24. }).then((res) => {
  25. if (!res.ok) {
  26. throw new Error(`HTTP error! status: ${res.status}`);
  27. }
  28. return res.json();
  29. });
  30. };
  31. export const similarIdentificationApi = (params: any) => {
  32. return fetch("/api/risk/similar", {
  33. method: "POST",
  34. headers: {
  35. "Content-Type": "application/json",
  36. Accept: "application/json",
  37. },
  38. body: JSON.stringify(params),
  39. }).then((res) => {
  40. if (!res.ok) {
  41. throw new Error(`HTTP error! status: ${res.status}`);
  42. }
  43. return res.json();
  44. });
  45. };