diff --git a/src/components/responsive/homePC/index.tsx b/src/components/responsive/homePC/index.tsx index 77e3619..d921698 100644 --- a/src/components/responsive/homePC/index.tsx +++ b/src/components/responsive/homePC/index.tsx @@ -8,22 +8,22 @@ import styles from "./index.module.css"; function HomePC() { const navigate = useNavigate(); const setRef = useSocketRefStore((state) => state.setRef); - + const handleClick = () => { requestPermission(); - const socketRef = new WebSocket( - `wss://${import.meta.env.VITE_HOST_NAME || "virtual-natsumatsuri-3jpy6th4da-an.a.run.app"}/ws?room_id=2` - ); - setRef({ current: socketRef }); - const audio = new Audio("/sound/wadaiko.mp3"); - audio - .play() - .then(() => { - setTimeout(() => {}, 500); - }) - .catch((error) => { - console.error("オーディオの音が出なかった", error); - }); + const socketRef = new WebSocket( + `wss://${import.meta.env.VITE_HOST_NAME || "virtual-natsumatsuri-3jpy6th4da-an.a.run.app"}/ws?room_id=2`, + ); + setRef({ current: socketRef }); + const audio = new Audio("/sound/wadaiko.mp3"); + audio + .play() + .then(() => { + setTimeout(() => {}, 500); + }) + .catch((error) => { + console.error("オーディオの音が出なかった", error); + }); navigate("/yatai"); }; diff --git a/src/components/responsive/homeSP/index.tsx b/src/components/responsive/homeSP/index.tsx index 384e188..92fdcbd 100644 --- a/src/components/responsive/homeSP/index.tsx +++ b/src/components/responsive/homeSP/index.tsx @@ -1,28 +1,28 @@ import { useNavigate } from "react-router-dom"; +import { useSocketRefStore } from "../../../store"; import { requestPermission } from "../../../utils/permission"; import { DefaultButton } from "../../ui/Button"; import styles from "./index.module.css"; -import { useSocketRefStore } from "../../../store"; function HomeSP() { const navigate = useNavigate(); const setRef = useSocketRefStore((state) => state.setRef); - + const handleClick = () => { requestPermission(); - const socketRef = new WebSocket( - `wss://${import.meta.env.VITE_HOST_NAME || "virtual-natsumatsuri-3jpy6th4da-an.a.run.app"}/ws?room_id=2` - ); - setRef({ current: socketRef }); - const audio = new Audio("/sound/wadaiko.mp3"); - audio - .play() - .then(() => { - setTimeout(() => {}, 500); - }) - .catch((error) => { - console.error("オーディオの音が出なかった", error); - }); + const socketRef = new WebSocket( + `wss://${import.meta.env.VITE_HOST_NAME || "virtual-natsumatsuri-3jpy6th4da-an.a.run.app"}/ws?room_id=2`, + ); + setRef({ current: socketRef }); + const audio = new Audio("/sound/wadaiko.mp3"); + audio + .play() + .then(() => { + setTimeout(() => {}, 500); + }) + .catch((error) => { + console.error("オーディオの音が出なかった", error); + }); navigate("/shooter"); };