mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-07-06 05:23:56 -07:00
fix websocket refactor mess
This commit is contained in:
parent
fea21b5057
commit
53639a8448
19 changed files with 179 additions and 209 deletions
|
|
@ -9,20 +9,20 @@ import TableCell from '@mui/material/TableCell';
|
|||
import TableHead from '@mui/material/TableHead';
|
||||
import TableRow from '@mui/material/TableRow';
|
||||
|
||||
|
||||
import { request } from '@app/api';
|
||||
import { useWebClient } from '@app/hooks';
|
||||
import { App } from '@app/types';
|
||||
|
||||
import './Rooms.css';
|
||||
|
||||
const Rooms = ({ rooms, joinedRooms }) => {
|
||||
const navigate = useNavigate();
|
||||
const webClient = useWebClient();
|
||||
|
||||
function onClick(roomId) {
|
||||
if (joinedRooms.find(room => room.info.roomId === roomId)) {
|
||||
navigate(generatePath(App.RouteEnum.ROOM, { roomId }));
|
||||
} else {
|
||||
request.rooms.joinRoom(roomId);
|
||||
webClient.request.rooms.joinRoom(roomId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue