store team in localstorage

This commit is contained in:
ntr
2019-06-05 16:48:59 +10:00
parent 9a9e7c9872
commit 211c2396bd
5 changed files with 27 additions and 4 deletions
+1 -1
View File
@@ -24,7 +24,7 @@ const addState = connect(
}
function sendInstanceList() {
return ws.sendAccountInstances();
return ws.sendInstanceList();
}
return {
+4 -3
View File
@@ -10,8 +10,8 @@ const List = require('./list');
const addState = connect(
state => {
const { game, instance, account, nav } = state;
return { game, instance, account, nav };
const { game, instance, account, nav, team } = state;
return { game, instance, account, nav, team };
}
);
@@ -21,6 +21,7 @@ function Main(props) {
instance,
account,
nav,
team,
} = props;
if (!account) {
@@ -35,8 +36,8 @@ function Main(props) {
return <Instance />;
}
if (nav === 'team') return <Team />;
if (nav === 'list') return <List />;
if (nav === 'team' || !team.some(t => t)) return <Team />;
return (
<main></main>
+1
View File
@@ -27,6 +27,7 @@ const addState = connect(
function receiveDispatch(dispatch) {
function setTeam(constructIds) {
localStorage.setItem('team', JSON.stringify(constructIds));
dispatch(actions.setTeam(constructIds));
}