File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -102,22 +102,22 @@ function startRound() {
102102}
103103
104104function 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}
You can’t perform that action at this time.
0 commit comments