Cleaned up email verification reducer logic

This commit is contained in:
Alexander Wong
2017-09-03 14:42:44 -06:00
parent a5df76d7e9
commit 4cadf5df3a
7 changed files with 35 additions and 99 deletions

View File

@@ -4,10 +4,6 @@ import {
CLEAR_AUTH_REQUEST_ERROR,
SET_AUTH_REQUEST_SUCCESS,
CLEAR_AUTH_REQUEST_SUCCESS,
SET_EMAIL_VERIFICATION_SUCCESS,
CLEAR_EMAIL_VERIFICATION_SUCCESS,
SET_EMAIL_VERIFICATION_ERROR,
CLEAR_EMAIL_VERIFICATION_ERROR,
SET_SELF_USER_TOKEN,
SET_FORM_EMAIL,
SET_FORM_PASSWORD,
@@ -70,6 +66,10 @@ export function setAuthRequestError(exception) {
error["UID"] = error.uid;
delete error["uid"];
}
if (error.key) {
error["Email Verification Key"] = error.key;
delete error["key"];
}
return {
type: SET_AUTH_REQUEST_ERROR,
@@ -96,42 +96,6 @@ export function clearAuthRequestSuccess() {
};
}
export function setEmailVerificationError(exception) {
let error = parseError(exception);
if (error.detail) {
error["Email"] = error.detail;
delete error["detail"];
}
if (error.key) {
error["Verification Key"] = error.key;
delete error["key"];
}
return {
type: SET_EMAIL_VERIFICATION_ERROR,
data: error
};
}
export function clearEmailVerificationError() {
return {
type: CLEAR_EMAIL_VERIFICATION_ERROR
};
}
export function setEmailVerificationSuccess(response) {
return {
type: SET_EMAIL_VERIFICATION_SUCCESS,
data: response.detail || response
};
}
export function clearEmailVerificationSuccess() {
return {
type: CLEAR_EMAIL_VERIFICATION_SUCCESS
};
}
export function setSelfUserToken(selfUser) {
return {
type: SET_SELF_USER_TOKEN,