update game url to use game code directly

This commit is contained in:
Nathaniel Tampus
2023-03-15 19:54:15 +08:00
parent b368d7bdf5
commit 3821c4b43a
7 changed files with 8 additions and 13 deletions

View File

@@ -24,7 +24,7 @@ export default function CreateGame() {
const game = await createGame(startingSide, unlisted.checked);
if (game) {
router.push(`/game/${game.code}`);
router.push(`/${game.code}`);
} else {
setButtonLoading(false);
// TODO: Show error message

View File

@@ -31,7 +31,7 @@ export default function JoinGame() {
const game = await getGame(code);
if (game && game.code) {
router.push(`/game/${game.code}`);
router.push(`/${game.code}`);
} else {
setButtonLoading(false);
setNotFound(true);

View File

@@ -9,7 +9,7 @@ export default function JoinButton({ code }: { code: string }) {
function handleJoin() {
startTransition(() => {
router.push(`/game/${code}`);
router.push(`/${code}`);
});
}