changed layout for a store variable
This commit is contained in:
@@ -63,6 +63,16 @@ export class ChatController {
|
||||
return res.status(HttpStatus.OK).json({ room_name: joinRoomDto.room_name, message: response });
|
||||
}
|
||||
|
||||
@UseGuards(AuthenticateGuard)
|
||||
@UseGuards(TwoFactorGuard)
|
||||
@Post('change')
|
||||
async changeRoom(@Body() joinRoomDto: joinRoomDto, @Req() req, @Res() res): Promise<object>
|
||||
{
|
||||
console.log("- in changeRoom controller");
|
||||
const response = await this.chatService.setCurrentRoom(req.user, joinRoomDto.room_name);
|
||||
return res.status(HttpStatus.OK).json({ room_name: joinRoomDto.room_name, message: response });
|
||||
}
|
||||
|
||||
@UseGuards(AuthenticateGuard)
|
||||
@UseGuards(TwoFactorGuard)
|
||||
@Post('leave')
|
||||
|
||||
@@ -33,7 +33,6 @@ export class ChatGateway
|
||||
joinRoom(@ConnectedSocket() socket, @MessageBody() room_name: string): void
|
||||
{
|
||||
console.log('- in joinRoom gateway');
|
||||
console.log(room_name);
|
||||
socket.join(room_name);
|
||||
}
|
||||
|
||||
@@ -42,7 +41,6 @@ export class ChatGateway
|
||||
{
|
||||
console.log('- in handleMessage gateway');
|
||||
let room_name = await this.chatService.getCurrentRoom(socket.username);
|
||||
console.log('room_name:', room_name);
|
||||
socket.to(room_name).emit('message', socket.username, message);
|
||||
this.chatService.addMessageToCurrentRoom(socket.username, message);
|
||||
}
|
||||
|
||||
@@ -138,8 +138,6 @@ export class ChatService {
|
||||
newChatroom.messages = [{ name: "SERVER", message: `creation of room ${createRoomDto.room_name}` }];
|
||||
this.chatroomRepository.save(newChatroom);
|
||||
|
||||
this.setCurrentRoom(user, createRoomDto.room_name)
|
||||
|
||||
return "successfull room creation";
|
||||
}
|
||||
|
||||
@@ -157,8 +155,6 @@ export class ChatService {
|
||||
const rooms = await this.getMyRooms(user);
|
||||
const allRooms = await this.getAllRooms();
|
||||
|
||||
this.setCurrentRoom(user, joinRoomDto.room_name)
|
||||
|
||||
return "successfull joining room";
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user