deploy frontend

This commit is contained in:
sparshg
2024-09-24 18:06:05 +05:30
parent f1bffbe56a
commit 103ac813f9
5 changed files with 53 additions and 4 deletions

View File

@@ -12,12 +12,12 @@ export class State {
turn = $state(-1); // -1 not my turn, 0 might be, 1 is
socket: Socket;
constructor(hostname: string, newSession: boolean = true) {
constructor(hostname: string) {
// let session = sessionStorage.getItem('session');
this.socket = io(`ws://${hostname}:3000/`, {
transports: ['websocket'],
auth: { session: !newSession ? sessionStorage.getItem('session') : null }
auth: { session: sessionStorage.getItem('session') }
});
this.socket.on('connect', () => {

View File

@@ -43,7 +43,7 @@
class="btn btn-error text-xl"
onclick={() => {
gameState.socket.emit('leave');
gameState = new State(window.location.hostname, true);
gameState = new State(window.location.hostname);
}}>Leave</button
>
</div>