File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -97,4 +97,26 @@ function startRound() {
9797 fetch ( "https://year8-chess-tournament-backend.glitch.me/start-round" , { method : "POST" } )
9898 . then ( res => res . json ( ) )
9999 . then ( data => alert ( `Started new round with ${ data . pairings } games.` ) ) ;
100+ }
101+
102+ function reportTroll ( ) {
103+ const user = firebase . auth ( ) . currentUser ;
104+ if ( ! user ) return alert ( "Please sign in first." ) ;
105+
106+ fetch ( "https://year8-chess-tournament-backend.glitch.me/report-troll" , {
107+ method : "POST" ,
108+ headers : { "Content-Type" : "application/json" } ,
109+ body : JSON . stringify ( { reporterId : user . uid } )
110+ } )
111+ . then ( res => res . json ( ) )
112+ . then ( data => {
113+ if ( data . success ) {
114+ alert ( "New game created due to trolling." ) ;
115+ const gameLink = document . getElementById ( "game-link" ) ;
116+ gameLink . href = data . newGameUrl ;
117+ gameLink . innerText = "Join New Game" ;
118+ } else {
119+ alert ( "Failed to create new game." ) ;
120+ }
121+ } ) ;
100122}
You can’t perform that action at this time.
0 commit comments