Skip to content
Snippets Groups Projects
Commit 6c36eff0 authored by alec.schmidt's avatar alec.schmidt
Browse files

fixed token bug

parent 7b1730a4
No related branches found
No related tags found
No related merge requests found
...@@ -22,7 +22,7 @@ import { RemoveCategoryComponent } from './question-shit/remove-category/remove- ...@@ -22,7 +22,7 @@ import { RemoveCategoryComponent } from './question-shit/remove-category/remove-
import { SocketIoConfig, SocketIoModule } from 'ngx-socket-io'; import { SocketIoConfig, SocketIoModule } from 'ngx-socket-io';
import { GameroomComponent } from './gameroom/gameroom.component'; import { GameroomComponent } from './gameroom/gameroom.component';
const config: SocketIoConfig = { url: 'http://0.0.0.0:30992', options: { } }; const config: SocketIoConfig = { url: 'http://0.0.0.0:30992', options: { autoConnect: false } };
@NgModule({ @NgModule({
declarations: [ declarations: [
......
...@@ -7,7 +7,7 @@ import { Answer } from '../Types/types'; ...@@ -7,7 +7,7 @@ import { Answer } from '../Types/types';
templateUrl: './gameroom.component.html', templateUrl: './gameroom.component.html',
styleUrls: ['./gameroom.component.css'] styleUrls: ['./gameroom.component.css']
}) })
export class GameroomComponent implements OnInit { export class GameroomComponent implements OnInit, OnDestroy {
playerNumber!: number; playerNumber!: number;
gameStart: boolean = false; gameStart: boolean = false;
...@@ -22,6 +22,9 @@ export class GameroomComponent implements OnInit { ...@@ -22,6 +22,9 @@ export class GameroomComponent implements OnInit {
private socket: SocketService) {} private socket: SocketService) {}
ngOnInit(): void { ngOnInit(): void {
this.socket.connectSocket();
this.gameStart = false; this.gameStart = false;
this.inRoom = false; this.inRoom = false;
this.endGame = false; this.endGame = false;
...@@ -53,6 +56,10 @@ export class GameroomComponent implements OnInit { ...@@ -53,6 +56,10 @@ export class GameroomComponent implements OnInit {
}) })
} }
ngOnDestroy(): void {
this.socket.disconnectSocket();
}
joinRoom(): void { joinRoom(): void {
this.socket.joinRoom(); this.socket.joinRoom();
this.inRoom = true; this.inRoom = true;
......
...@@ -29,6 +29,11 @@ export class SocketService { ...@@ -29,6 +29,11 @@ export class SocketService {
this.recieveQuestion(); this.recieveQuestion();
} }
connectSocket() {
this.refreshSocketToken();
this.socket.connect();
}
get playerNumber() { get playerNumber() {
return this._playerNumber.asObservable(); return this._playerNumber.asObservable();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment