separate DMs and spectators

This commit is contained in:
Gavin McDonald
2025-04-14 14:22:06 -04:00
parent 4189e41da5
commit 424b8e0ec3
4 changed files with 59 additions and 21 deletions

View File

@@ -1,13 +1,17 @@
'use client';
import { useRouter } from 'next/navigation';
import generateID from '@/tools/simpleID';
import { socket } from '@/socket';
import { GameUpdate } from '@/types';
export default function Home() {
const router = useRouter();
const handleCreateGame = () => {
const id = generateID();
router.push(`/${id}`);
socket.emit('start');
socket.on('new-game', (game: GameUpdate) => {
router.push(`/${game.dmID}`);
});
};
return (