Spaces:
Sleeping
Sleeping
| 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; | |