Using sqlite database, mt proctor animation.
This commit is contained in:
23
src/main.jsx
23
src/main.jsx
@@ -28,7 +28,8 @@ import { rootId } from './constants.js'
|
||||
import App from './components/app/App.jsx'
|
||||
import { initialize, handleMessage as handleMessageFarm } from './components/farm/interface.js'
|
||||
|
||||
import { setStartGames, startOrJoinGame } from './components/start/actions.js'
|
||||
import { setStartGames, startOrJoinGame, setUser, setOpenGames,
|
||||
setErrors } from './components/start/actions.js'
|
||||
import { play } from './components/app/actions.js'
|
||||
import { createStore } from 'redux'
|
||||
import rootReducer from './rootReducers.js'
|
||||
@@ -46,9 +47,24 @@ document.body.appendChild(makeDiv(rootId));
|
||||
|
||||
window.store = store;
|
||||
|
||||
const createAccount = (msg) => {
|
||||
Ws.sendCommand({ type: 'create-account', ...msg});
|
||||
}
|
||||
|
||||
const login = (msg) => {
|
||||
Ws.sendCommand({ type: 'login', ...msg});
|
||||
}
|
||||
|
||||
const logout = () => {
|
||||
Ws.sendCommand({ type: 'logout'});
|
||||
}
|
||||
|
||||
ReactDOM.render(
|
||||
<Provider store={store}>
|
||||
<App />
|
||||
<App createAccount={createAccount}
|
||||
login={login}
|
||||
logout={logout}
|
||||
/>
|
||||
</Provider>,
|
||||
document.getElementById(rootId)
|
||||
);
|
||||
@@ -78,6 +94,9 @@ function handleMessage(evt) {
|
||||
store.dispatch(play());
|
||||
} else if (data.event === 'start-init') {
|
||||
store.dispatch(setStartGames(data.games.games));
|
||||
store.dispatch(setOpenGames(data.openGames.games));
|
||||
store.dispatch(setUser(data.user));
|
||||
store.dispatch(setErrors(data.errors));
|
||||
if (autostart) {
|
||||
if (data.games.games.length === 0) {
|
||||
store.dispatch(startOrJoinGame({ type: 'new-game',
|
||||
|
||||
Reference in New Issue
Block a user