Added 3 second delay to account creation to sidestep a bug

This commit is contained in:
2019-06-01 01:39:11 +10:00
parent 4a2bfb3db9
commit 29e86e4032
4 changed files with 41 additions and 18 deletions
+7
View File
@@ -5,6 +5,7 @@ export const STORE_RECRUITS = 'STORE_RECRUITS';
export const STORE_SOLDIERS = 'STORE_SOLDIERS';
export const STORE_SPIES = 'STORE_SPIES';
export const STORE_SCIENTISTS = 'STORE_SCIENTISTS';
export const CLEAR_PROFILE = 'CLEAR_PROFILE';
export const storeProfile = (username, gold, recruits, soldiers, spies, scientists) => {
return {
@@ -58,4 +59,10 @@ export const storeScientists = (scientists) => {
type: STORE_SCIENTISTS,
scientists: scientists
};
}
export const clearProfile = () => {
return {
type: CLEAR_PROFILE
};
}
+7 -2
View File
@@ -4,7 +4,7 @@ import { connect } from 'react-redux';
import queryString from 'query-string';
//actions
import { storeProfile } from '../../actions/profile.js';
import { storeProfile, clearProfile } from '../../actions/profile.js';
//panels
import CommonLinks from '../panels/common_links.jsx';
@@ -22,6 +22,10 @@ class Profile extends React.Component {
this.sendRequest('/profilerequest', {username: this.state.params.username ? this.state.params.username : this.props.account.username});
}
componentWillUnmount() {
this.props.clearProfile();
}
render() {
let warningStyle = {
display: this.state.warning.length > 0 ? 'flex' : 'none'
@@ -343,7 +347,8 @@ const mapStoreToProps = (store) => {
const mapDispatchToProps = (dispatch) => {
return {
storeProfile: (username, gold, recruits, soldiers, spies, scientists) => dispatch(storeProfile(username, gold, recruits, soldiers, spies, scientists))
storeProfile: (username, gold, recruits, soldiers, spies, scientists) => dispatch(storeProfile(username, gold, recruits, soldiers, spies, scientists)),
clearProfile: () => dispatch(clearProfile())
};
};
+6 -1
View File
@@ -5,7 +5,8 @@ import {
STORE_RECRUITS,
STORE_SOLDIERS,
STORE_SPIES,
STORE_SCIENTISTS
STORE_SCIENTISTS,
CLEAR_PROFILE
} from '../actions/profile.js';
const initialStore = {
@@ -53,6 +54,10 @@ export const profileReducer = (store = initialStore, action) => {
case STORE_SCIENTISTS:
newStore.scientists = action.scientists;
break;
case CLEAR_PROFILE:
newStore = JSON.parse(JSON.stringify(initialStore));
break;
};
return newStore;