Add server player to initial player list

This commit is contained in:
Hamcha 2019-10-09 17:47:03 +02:00
parent 69f9cb6843
commit 8e519d0a34
Signed by: hamcha
GPG key ID: 44AD3571EB09A39E

View file

@ -1,15 +1,12 @@
import { ChatMessage, LocalClient, PeerClient, PeerServer } from "@/network";
import { MutationTree } from "vuex";
import {
NetworkState,
ServerNetworkState,
ClientNetworkState,
ConnectionStatus
} from "./types";
import { LocalClient, PeerServer, PeerClient, ChatMessage } from "@/network";
import { ClientNetworkState, ConnectionStatus, NetworkState, ServerNetworkState } from "./types";
const mutations: MutationTree<NetworkState> = {
becomeServer(state, payload: { local: LocalClient; server: PeerServer }) {
state.peerType = "server";
state.players = [payload.local.name];
(state as ServerNetworkState).local = payload.local;
(state as ServerNetworkState).server = payload.server;
},