...
|
...
|
@@ -25,7 +25,9 @@ const { |
|
|
PWD_MODIFY_OLD,
|
|
|
PWD_MODIFY_NEW,
|
|
|
PWD_MODIFY_REPEAT,
|
|
|
PWD_MODIFY_SUBMIT,
|
|
|
PWD_MODIFY_REQUEST,
|
|
|
PWD_MODIFY_SUCCESS,
|
|
|
PWD_MODIFY_FAILURE,
|
|
|
|
|
|
LOGIN_REQUEST,
|
|
|
LOGIN_SUCCESS,
|
...
|
...
|
@@ -37,11 +39,6 @@ const { |
|
|
|
|
|
SET_SESSION_TOKEN,
|
|
|
|
|
|
RESET_PASSWORD_REQUEST,
|
|
|
RESET_PASSWORD_SUCCESS,
|
|
|
RESET_PASSWORD_FAILURE,
|
|
|
|
|
|
|
|
|
PHONE_CALL,
|
|
|
ABOUT_US,
|
|
|
USER_ITEMS_PRESSED,
|
...
|
...
|
@@ -193,29 +190,41 @@ export function pwdModifyRepeat(pwd) { |
|
|
};
|
|
|
}
|
|
|
|
|
|
export function modifySubmitRequest() {
|
|
|
return {
|
|
|
type: PWD_MODIFY_REQUEST
|
|
|
};
|
|
|
}
|
|
|
|
|
|
export function modifySubmitSuccess() {
|
|
|
Actions.pop();
|
|
|
return {
|
|
|
type: PWD_MODIFY_SUCCESS
|
|
|
};
|
|
|
}
|
|
|
|
|
|
export function modifySubmitFailure() {
|
|
|
return {
|
|
|
type: PWD_MODIFY_FAILURE
|
|
|
};
|
|
|
}
|
|
|
|
|
|
export function pwdModifySubmit(pid, oldPwd, newPwd,newPwdConfirm) {
|
|
|
let userService = new UserService();
|
|
|
return dispatch => {
|
|
|
dispatch(loginRequest());
|
|
|
dispatch(modifySubmitRequest());
|
|
|
return userService.modifyPassword(pid, oldPwd, newPwd,newPwdConfirm)
|
|
|
.then(function (json) {
|
|
|
Alert.alert(
|
|
|
'修改成功',
|
|
|
'',
|
|
|
[
|
|
|
{text: 'OK', onPress: () => Actions.pop()},
|
|
|
]
|
|
|
);
|
|
|
dispatch(modifySubmitDone());
|
|
|
|
|
|
dispatch(modifySubmitSuccess());
|
|
|
dispatch(logout());
|
|
|
})
|
|
|
.catch((error) => {
|
|
|
Alert.alert(
|
|
|
error.message,
|
|
|
'',
|
|
|
[{text: 'OK'}]
|
|
|
);
|
|
|
dispatch(loginFailure(error));
|
|
|
error.message,
|
|
|
'',
|
|
|
[{text: 'OK'}]
|
|
|
);
|
|
|
dispatch(modifySubmitFailure(error));
|
|
|
});
|
|
|
};
|
|
|
}
|
...
|
...
|
@@ -230,7 +239,7 @@ export function login(account, password) { |
|
|
return userService.storeUserInfo(json)
|
|
|
.then(() => {
|
|
|
dispatch(loginSuccess(json));
|
|
|
dispatch(setupHomeDefaultBrand(json.shops[0].shopsId, json.shops[0].shopName))
|
|
|
dispatch(setupHomeDefaultShop(json.shops[0].shopsId, json.shops[0].shopName));
|
|
|
Actions.Drawer();
|
|
|
});
|
|
|
})
|
...
|
...
|
@@ -246,14 +255,6 @@ export function login(account, password) { |
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
export function modifySubmitDone() {
|
|
|
Actions.pop();
|
|
|
return {
|
|
|
type: PWD_MODIFY_SUBMIT
|
|
|
};
|
|
|
}
|
|
|
|
|
|
export function getStoredUserInfo() {
|
|
|
|
|
|
return dispatch => {
|
...
|
...
|
|