Commit 08db0ada authored by Chunchi Che's avatar Chunchi Che

add reset logic

parent 75cc489c
Pipeline #23004 passed with stages
in 15 minutes and 20 seconds
......@@ -61,7 +61,7 @@ export default async function handleSocketMessage(e: MessageEvent) {
break;
}
case "stoc_select_hand": {
await handleSelectHand(pb);
handleSelectHand(pb);
break;
}
......@@ -71,7 +71,7 @@ export default async function handleSocketMessage(e: MessageEvent) {
break;
}
case "stoc_select_tp": {
await handleSelectTp(pb);
handleSelectTp(pb);
break;
}
......
......@@ -34,7 +34,7 @@ devtools(roomStore, { name: "room", enabled: DEV });
devtools(deckStore, { name: "deck", enabled: DEV });
devtools(initStore, { name: "init", enabled: DEV });
// 重置所有`Store`
// 重置`Store`
export const resetUniverse = () => {
roomStore.reset();
cardStore.reset();
......@@ -42,4 +42,5 @@ export const resetUniverse = () => {
matStore.reset();
placeStore.reset();
replayStore.reset();
roomStore.reset();
};
......@@ -26,6 +26,7 @@ import {
deckStore,
IDeck,
Player,
resetUniverse,
RoomStage,
roomStore,
} from "@/stores";
......@@ -294,6 +295,8 @@ const SideButtons: React.FC<{
onClick={() => {
// 断开websocket🔗,
socketMiddleWare({ cmd: socketCmd.DISCONNECT });
// 重置stores
resetUniverse();
// 返回上一个路由
navigate("..");
}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment