This commit is contained in:
22
server.js
22
server.js
@@ -45,13 +45,21 @@ app.post("/report", async (req, res) => {
|
|||||||
|
|
||||||
console.log(url)
|
console.log(url)
|
||||||
|
|
||||||
const resp = await fetch(url, {
|
let resp;
|
||||||
method: "POST",
|
|
||||||
headers: {
|
try {
|
||||||
"Content-Type": "text/plain",
|
resp = await fetch(url, {
|
||||||
},
|
method: "POST",
|
||||||
body: `${content}\n\nClass: ${className}\nLocation: ${location}`,
|
headers: {
|
||||||
});
|
"Content-Type": "text/plain",
|
||||||
|
},
|
||||||
|
body: `${content}\n\nClass: ${className}\nLocation: ${location}`,
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Fetch failed:', err.message);
|
||||||
|
console.error(err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
throw new Error(`Request failed`);
|
throw new Error(`Request failed`);
|
||||||
|
|||||||
Reference in New Issue
Block a user