Int_Prog/лаб3/lab3/public/scripts/api/createObject.js

13 lines
295 B
JavaScript
Raw Permalink Normal View History

2024-01-18 23:29:33 +04:00
import { serverPath } from "../variables.js";
export async function createObject(objectJSON) {
const response = await fetch(`${serverPath}/products`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: objectJSON,
});
return response.json();
}