mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
refactor redux data model
This commit is contained in:
parent
ae1bc3da38
commit
0ff391491d
243 changed files with 5212 additions and 5963 deletions
49
webclient/src/api/response/RoomResponseImpl.ts
Normal file
49
webclient/src/api/response/RoomResponseImpl.ts
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import { Data, Enriched } from '@app/types';
|
||||
import type { IRoomResponse } from '@app/websocket';
|
||||
import { RoomsDispatch } from '@app/store';
|
||||
|
||||
export class RoomResponseImpl implements IRoomResponse {
|
||||
clearStore(): void {
|
||||
RoomsDispatch.clearStore();
|
||||
}
|
||||
|
||||
joinRoom(roomInfo: Data.ServerInfo_Room): void {
|
||||
RoomsDispatch.joinRoom(roomInfo);
|
||||
}
|
||||
|
||||
leaveRoom(roomId: number): void {
|
||||
RoomsDispatch.leaveRoom(roomId);
|
||||
}
|
||||
|
||||
updateRooms(rooms: Data.ServerInfo_Room[]): void {
|
||||
RoomsDispatch.updateRooms(rooms);
|
||||
}
|
||||
|
||||
updateGames(roomId: number, gameList: Data.ServerInfo_Game[]): void {
|
||||
RoomsDispatch.updateGames(roomId, gameList);
|
||||
}
|
||||
|
||||
addMessage(roomId: number, message: Enriched.Message): void {
|
||||
RoomsDispatch.addMessage(roomId, message);
|
||||
}
|
||||
|
||||
userJoined(roomId: number, user: Data.ServerInfo_User): void {
|
||||
RoomsDispatch.userJoined(roomId, user);
|
||||
}
|
||||
|
||||
userLeft(roomId: number, name: string): void {
|
||||
RoomsDispatch.userLeft(roomId, name);
|
||||
}
|
||||
|
||||
removeMessages(roomId: number, name: string, amount: number): void {
|
||||
RoomsDispatch.removeMessages(roomId, name, amount);
|
||||
}
|
||||
|
||||
gameCreated(roomId: number): void {
|
||||
RoomsDispatch.gameCreated(roomId);
|
||||
}
|
||||
|
||||
joinedGame(roomId: number, gameId: number): void {
|
||||
RoomsDispatch.joinedGame(roomId, gameId);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue