fix team nav bug

This commit is contained in:
Mashy 2019-07-25 14:29:05 +10:00
parent 384cdb2de5
commit a3a2cf9852
2 changed files with 11 additions and 19 deletions

View File

@ -1,4 +1,3 @@
const toast = require('izitoast');
const eachSeries = require('async/eachSeries');
const actions = require('./actions');
@ -31,6 +30,8 @@ function registerEvents(store) {
}
store.dispatch(actions.setConstructs(constructs));
// Now that constructs have been set we can switch to list
setNav('list');
}
function setInstanceList(list) {
@ -158,7 +159,7 @@ function registerEvents(store) {
}
function setInstance(v) {
const { account, ws, instance } = store.getState();
const { account, instance } = store.getState();
if (v) {
const player = v.players.find(p => p.id === account.id);
store.dispatch(actions.setPlayer(player));
@ -176,6 +177,11 @@ function registerEvents(store) {
return store.dispatch(actions.setItemInfo(v));
}
const team = JSON.parse(localStorage.getItem('team'));
if (team && team.every(t => t)) {
store.dispatch(actions.setTeam(team));
}
// events.on('SET_PLAYER', setInstance);
// events.on('SEND_SKILL', function skillActive(gameId, constructId, targetConstructId, skill) {
@ -190,14 +196,7 @@ function registerEvents(store) {
// return setConstructs(constructs);
// });
const errMessages = {
select_constructs: 'Select your constructs before battle using the numbered buttons next to the construct avatar',
complete_nodes: 'You need to complete the previously connected nodes first',
max_skills: 'Your construct can only learn a maximum of 4 skills',
};
function errorPrompt(type) {
/* function errorPrompt(type) {
const message = errMessages[type];
const OK_BUTTON = '<button type="submit">OK</button>';
toast.error({
@ -213,14 +212,8 @@ function registerEvents(store) {
],
message,
});
}
} */
// setup / localstorage
const team = JSON.parse(localStorage.getItem('team'));
if (team && team.every(t => t)) {
setTeam(team);
setNav('list');
}
return {
clearCombiner,
@ -228,7 +221,6 @@ function registerEvents(store) {
clearInfo,
clearInstance,
clearMtxActive,
errorPrompt,
setAccount,
setAccountInstances,
setActiveItem,

View File

@ -36,7 +36,7 @@ module.exports = {
itemInfo: createReducer({ combos: [], items: [] }, 'SET_ITEM_INFO'),
itemUnequip: createReducer([], 'SET_ITEM_UNEQUIP'),
mtxActive: createReducer(null, 'SET_MTX_ACTIVE'),
nav: createReducer('team', 'SET_NAV'),
nav: createReducer(null, 'SET_NAV'),
showNav: createReducer(null, 'SET_SHOW_NAV'),
ping: createReducer(null, 'SET_PING'),
player: createReducer(null, 'SET_PLAYER'),