store team in localstorage
This commit is contained in:
parent
9a9e7c9872
commit
211c2396bd
@ -46,6 +46,9 @@ locaalstorage team
|
|||||||
remove rounds
|
remove rounds
|
||||||
consolidate game and instance
|
consolidate game and instance
|
||||||
|
|
||||||
|
do not allow vbox actions for finished instances
|
||||||
|
cause of logging
|
||||||
|
|
||||||
|
|
||||||
*SERVER*
|
*SERVER*
|
||||||
* std game mode
|
* std game mode
|
||||||
|
|||||||
@ -24,7 +24,7 @@ const addState = connect(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sendInstanceList() {
|
function sendInstanceList() {
|
||||||
return ws.sendAccountInstances();
|
return ws.sendInstanceList();
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
@ -10,8 +10,8 @@ const List = require('./list');
|
|||||||
|
|
||||||
const addState = connect(
|
const addState = connect(
|
||||||
state => {
|
state => {
|
||||||
const { game, instance, account, nav } = state;
|
const { game, instance, account, nav, team } = state;
|
||||||
return { game, instance, account, nav };
|
return { game, instance, account, nav, team };
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -21,6 +21,7 @@ function Main(props) {
|
|||||||
instance,
|
instance,
|
||||||
account,
|
account,
|
||||||
nav,
|
nav,
|
||||||
|
team,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
if (!account) {
|
if (!account) {
|
||||||
@ -35,8 +36,8 @@ function Main(props) {
|
|||||||
return <Instance />;
|
return <Instance />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nav === 'team') return <Team />;
|
|
||||||
if (nav === 'list') return <List />;
|
if (nav === 'list') return <List />;
|
||||||
|
if (nav === 'team' || !team.some(t => t)) return <Team />;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<main></main>
|
<main></main>
|
||||||
|
|||||||
@ -27,6 +27,7 @@ const addState = connect(
|
|||||||
|
|
||||||
function receiveDispatch(dispatch) {
|
function receiveDispatch(dispatch) {
|
||||||
function setTeam(constructIds) {
|
function setTeam(constructIds) {
|
||||||
|
localStorage.setItem('team', JSON.stringify(constructIds));
|
||||||
dispatch(actions.setTeam(constructIds));
|
dispatch(actions.setTeam(constructIds));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,6 +11,8 @@ function registerEvents(store) {
|
|||||||
store.subscribe(() => {
|
store.subscribe(() => {
|
||||||
const { game, instance, constructs, ws } = store.getState();
|
const { game, instance, constructs, ws } = store.getState();
|
||||||
|
|
||||||
|
if (!ws) return true;
|
||||||
|
|
||||||
if (!game) ws.clearGameStateTimeout();
|
if (!game) ws.clearGameStateTimeout();
|
||||||
if (!instance) ws.clearInstanceStateTimeout();
|
if (!instance) ws.clearInstanceStateTimeout();
|
||||||
});
|
});
|
||||||
@ -19,6 +21,15 @@ function registerEvents(store) {
|
|||||||
store.dispatch(actions.setPing(ping));
|
store.dispatch(actions.setPing(ping));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setTeam(team) {
|
||||||
|
localStorage.setItem('team', JSON.stringify(team));
|
||||||
|
store.dispatch(actions.setTeam(team));
|
||||||
|
}
|
||||||
|
|
||||||
|
function setNav(v) {
|
||||||
|
store.dispatch(actions.setNav(v));
|
||||||
|
}
|
||||||
|
|
||||||
function setConstructs(constructs) {
|
function setConstructs(constructs) {
|
||||||
console.log('EVENT ->', 'constructs', constructs);
|
console.log('EVENT ->', 'constructs', constructs);
|
||||||
}
|
}
|
||||||
@ -190,6 +201,13 @@ function registerEvents(store) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setup / localstorage
|
||||||
|
const team = JSON.parse(localStorage.getItem('team'));
|
||||||
|
if (team && team.every(t => t)) {
|
||||||
|
setTeam(team);
|
||||||
|
setNav('list');
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
errorPrompt,
|
errorPrompt,
|
||||||
clearCombiner,
|
clearCombiner,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user