You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
396 B
16 lines
396 B
3 months ago
|
export const post = (url, data) => {
|
||
|
const options = {
|
||
|
method: 'POST',
|
||
|
body: JSON.stringify(data),
|
||
|
headers: {
|
||
|
'Content-Type': 'application/json',
|
||
|
},
|
||
|
};
|
||
|
return new Promise((reslove, reject) => {
|
||
|
fetch(url, options)
|
||
|
.then((response) => response.json())
|
||
|
.then((data) => console.log(data))
|
||
|
.catch((error) => console.error('Error:', error));
|
||
|
});
|
||
|
};
|