mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
changes
This commit is contained in:
@@ -14,11 +14,3 @@ export const setPassword = password => ({
|
||||
type: actions.SET_PASSWORD,
|
||||
password,
|
||||
});
|
||||
|
||||
export const enableSubmitSignUpForm = () => ({
|
||||
type: actions.ENABLE_SUBMIT_SIGNUP_FORM,
|
||||
});
|
||||
|
||||
export const disableSubmitSignUpForm = () => ({
|
||||
type: actions.DISABLE_SUBMIT_SIGNUP_FORM,
|
||||
});
|
||||
|
||||
@@ -3,5 +3,3 @@ const prefix = 'TALK_AUTH';
|
||||
export const SET_VIEW = `${prefix}_SET_VIEW`;
|
||||
export const SET_EMAIL = `${prefix}_SET_EMAIL`;
|
||||
export const SET_PASSWORD = `${prefix}_SET_PASSWORD`;
|
||||
export const ENABLE_SUBMIT_SIGNUP_FORM = `${prefix}_ENABLE_SUBMIT_SIGNUP_FORM`;
|
||||
export const DISABLE_SUBMIT_SIGNUP_FORM = `${prefix}_DISABLE_SUBMIT_SIGNUP_FOR`;
|
||||
|
||||
@@ -22,8 +22,19 @@ class SignUpContainer extends Component {
|
||||
emailError: null,
|
||||
passwordError: null,
|
||||
passwordRepeatError: null,
|
||||
hasBlockers: [],
|
||||
};
|
||||
|
||||
indicateBlockerOn = plugin =>
|
||||
this.setState(state => ({
|
||||
hasBlockers: state.hasBlockers.concat(plugin),
|
||||
}));
|
||||
|
||||
indicateBlockerOff = plugin =>
|
||||
this.setState(state => ({
|
||||
hasNotifications: state.hasNotifications.filter(i => i !== plugin),
|
||||
}));
|
||||
|
||||
validate = data => {
|
||||
let valid = true;
|
||||
const changes = {};
|
||||
@@ -54,7 +65,7 @@ class SignUpContainer extends Component {
|
||||
passwordRepeat: this.state.passwordRepeat,
|
||||
};
|
||||
|
||||
if (this.validate(data)) {
|
||||
if (this.validate(data) && !this.state.hasBlockers.length) {
|
||||
this.props.signUp(data);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -5,21 +5,10 @@ const initialState = {
|
||||
view: views.SIGN_IN,
|
||||
email: '',
|
||||
password: '',
|
||||
submitSignUpForm: true,
|
||||
};
|
||||
|
||||
export default function reducer(state = initialState, action) {
|
||||
switch (action.type) {
|
||||
case actions.ENABLE_SUBMIT_SIGNUP_FORM:
|
||||
return {
|
||||
...state,
|
||||
submitSignUpForm: true,
|
||||
};
|
||||
case actions.DISABLE_SUBMIT_SIGNUP_FORM:
|
||||
return {
|
||||
...state,
|
||||
submitSignUpForm: false,
|
||||
};
|
||||
case actions.SET_VIEW:
|
||||
return {
|
||||
...state,
|
||||
|
||||
Reference in New Issue
Block a user