Skip to content

Commit 9663485

Browse files
Update app.js
1 parent c146fc4 commit 9663485

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

app.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -102,22 +102,22 @@ function startRound() {
102102
}
103103

104104
function reportTroll() {
105-
fetch("https://your-backend.glitch.me/report-troll", {
105+
if (!currentUser) {
106+
alert("Please sign in first.");
107+
return;
108+
}
109+
110+
fetch("https://year8-chess-tournament-backend.glitch.me/report-troll", {
106111
method: "POST",
107-
headers: {
108-
"Content-Type": "application/json"
109-
},
112+
headers: { "Content-Type": "application/json" },
110113
body: JSON.stringify({ reporterId: currentUser.uid })
111114
})
112-
.then(res => res.json())
113-
.then(data => {
114-
if (data.success) {
115-
alert("Opponent reported. You have a new game link.");
116-
} else {
117-
alert("Something went wrong reporting the opponent.");
118-
}
119-
})
120-
.catch(err => {
121-
console.error("Error reporting opponent:", err);
122-
});
115+
.then(res => res.json())
116+
.then(data => {
117+
if (data.success) {
118+
alert("New game created. Use your new link.");
119+
} else {
120+
alert("Failed to create a new game.");
121+
}
122+
});
123123
}

0 commit comments

Comments
 (0)