Spaces:
Running
Running
File size: 463 Bytes
819bacd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
import baseUrl from "../api.config";
const postDocument = async (url, data) => {
const response = await fetch(baseUrl + url, {
method: "POST",
body: data,
});
if (!response.ok) {
const errorData = await response.json();
const error = new Error("HTTP error");
error.status = response.status;
error.detail = errorData.detail || "Something went wrong";
throw error;
}
return response.json();
};
export default postDocument;
|