diff --git a/js-frontend/src/actions/entities.js b/js-frontend/src/actions/entities.js
index 2778392..89dc4c7 100644
--- a/js-frontend/src/actions/entities.js
+++ b/js-frontend/src/actions/entities.js
@@ -53,14 +53,15 @@ export function accountCreate(customerId, payload) {
id: accountId,
...payload
}));
- dispatch(entityReceived(accountId, payload));
- return dispatch(authenticate(true));
+ // dispatch(entityReceived(accountId, payload));
+ dispatch(authenticate(true));
+ return accountId;
})
.catch(err => {
debugger;
dispatch(accountCreateError(err));
- return Promise.resolve({ error: err });
- })
+ // return Promise.resolve({ error: err });
+ });
};
}
diff --git a/js-frontend/src/actions/signUp.js b/js-frontend/src/actions/signUp.js
index bd3a7f4..fdb2f34 100644
--- a/js-frontend/src/actions/signUp.js
+++ b/js-frontend/src/actions/signUp.js
@@ -10,7 +10,8 @@ import { entityReceived } from './entities';
import { storeCurrentEndpointKey } from "./configure";
//import { parseResponse } from "../utils/handleFetchResponse";
import { apiSignUp } from "../utils/api";
-import { emailSignIn } from './signIn';
+import { emailSignInFormUpdate } from './signIn';
+import { push } from 'redux-router';
import T from '../constants/ACTION_TYPES';
@@ -38,9 +39,8 @@ export function emailSignUp(body) {
.then(({data}) => {
dispatch(emailSignUpComplete(data));
const { email } = body;
- return new Promise((rs, rj) => {
- dispatch(emailSignIn({ email })).then(rs).catch(rj);
- });
+ dispatch(emailSignInFormUpdate('email', email));
+ dispatch(push('/signin'));
})
.catch(({errors}) => dispatch(emailSignUpError(errors)));
diff --git a/js-frontend/src/components/TransfersTable.js b/js-frontend/src/components/TransfersTable.js
index 0422e3d..b6e59b3 100644
--- a/js-frontend/src/components/TransfersTable.js
+++ b/js-frontend/src/components/TransfersTable.js
@@ -20,7 +20,7 @@ export class TransfersTable extends React.Component {
return (
Errors..
);
}
- const transfers = data.map(({
+ const transfers = data.length ? data.map(({
amount,
fromAccountId,
toAccountId,
@@ -35,7 +35,10 @@ export class TransfersTable extends React.Component {
|
{ description || 'N/a'} |
{ status || 'N/a' } |
- ));
+ )) : (
+ | No transfers for this account just yet. |
+
);
+
return (
diff --git a/js-frontend/src/constants/ACTION_TYPES.js b/js-frontend/src/constants/ACTION_TYPES.js
index ac9dede..be3284b 100644
--- a/js-frontend/src/constants/ACTION_TYPES.js
+++ b/js-frontend/src/constants/ACTION_TYPES.js
@@ -40,6 +40,10 @@ export default defineActionTypes({
CREATE_COMPLETE
CREATE_ERROR
CREATE_FORM_UPDATE
+ EDIT_START
+ EDIT_COMPLETE
+ EDIT_ERROR
+ EDIT_FORM_UPDATE
CREATE_REF_START
CREATE_REF_COMPLETE
CREATE_REF_ERROR
diff --git a/js-frontend/src/controls/bootstrap/EmailSignUpForm.js b/js-frontend/src/controls/bootstrap/EmailSignUpForm.js
index df0d634..69a7cf9 100644
--- a/js-frontend/src/controls/bootstrap/EmailSignUpForm.js
+++ b/js-frontend/src/controls/bootstrap/EmailSignUpForm.js
@@ -18,23 +18,6 @@ import {emailSignUpFormUpdate, emailSignUp} from '../../actions/signUp';
class EmailSignUpForm extends React.Component {
- static propTypes = {
- //endpoint: PropTypes.string,
- inputProps: PropTypes.shape({
- email: PropTypes.object,
- password: PropTypes.object,
- passwordConfirmation: PropTypes.object,
- submit: PropTypes.object
- })
- };
-
- static defaultProps = {
- inputProps: {
- email: {},
- password: {},
- submit: {}
- }
- };
getEndpoint () {
return (
@@ -52,19 +35,15 @@ class EmailSignUpForm extends React.Component {
event.preventDefault();
let formData = { ...this.props.auth.signUp.form };
-
- console.log(customerInfoMap(formData));
this.props.dispatch(emailSignUp(customerInfoMap(formData)));
}
render () {
- try {
-
- const disabled = (
- this.props.auth.user.isSignedIn ||
- this.props.auth.signUp.loading
- );
+ const disabled = (
+ this.props.auth.user.isSignedIn ||
+ this.props.auth.signUp.loading
+ );
return (
+ />
+ />
+ />
@@ -115,7 +94,7 @@ class EmailSignUpForm extends React.Component {
value={read(this.props.auth, 'signUp.form.ssn', '')}
errors={read(this.props.auth, 'signUp.errors.ssn', [])}
onChange={this.handleInput.bind(this, "ssn")}
- {...this.props.inputProps.ssn} />
+ />
+ />
+ />
+ />
+ />
+ />
+ />
@@ -193,15 +172,12 @@ class EmailSignUpForm extends React.Component {
icon={}
disabled={disabled}
onClick={this.handleSubmit.bind(this)}
- { ...this.props.inputProps.submit } >
+ >
Sign Up
);
- } catch (ex){
- console.error('Render exception: ', ex);
- return [' ERROR '];
- }
+
}
}
diff --git a/js-frontend/src/reducers/data/accounts.js b/js-frontend/src/reducers/data/accounts.js
index 7ff92d7..d5aae75 100644
--- a/js-frontend/src/reducers/data/accounts.js
+++ b/js-frontend/src/reducers/data/accounts.js
@@ -35,7 +35,7 @@ const otherAccountsReducer = (state = [], action ) => {
case T.ACCOUNTS.LIST_REF_COMPLETE: {
const { payload = {} } = action;
- const accounts = Object.keys(payload).map(key => ((payload[key].id = payload[key].accountId), payload[key]));
+ const accounts = Object.keys(payload).map(key => payload[key]);
return [
...accounts
];
@@ -53,9 +53,17 @@ const createAccountReducer = createFormReducer([
T.ACCOUNTS.CREATE_FORM_UPDATE
]);
+const editAccountReducer = createFormReducer([
+ T.ACCOUNTS.EDIT_START,
+ T.ACCOUNTS.EDIT_COMPLETE,
+ T.ACCOUNTS.EDIT_ERROR,
+ T.ACCOUNTS.EDIT_FORM_UPDATE
+]);
+
export const accounts = combineReducers({
own: ownAccountsReducer,
other: otherAccountsReducer,
- create: createAccountReducer
+ create: createAccountReducer,
+ edit: editAccountReducer
});
diff --git a/js-frontend/src/views/MyAccounts.js b/js-frontend/src/views/MyAccounts.js
index f1e5958..7517931 100644
--- a/js-frontend/src/views/MyAccounts.js
+++ b/js-frontend/src/views/MyAccounts.js
@@ -50,8 +50,8 @@ class MyAccounts extends React.Component {
} = this.props.auth.user.attributes;
this.props.dispatch(A.accountCreate(customerId, payload))
- .then(() => {
- this.close.bind(this);
+ .then((accountId) => {
+ this.close();
return this.props.dispatch(A.fetchOwnAccounts(customerId));
})
.catch(err => {
@@ -61,7 +61,6 @@ class MyAccounts extends React.Component {
}
create3rdPartyAccountModal() {
-
this.setState({
show3rdPartyAccountModal: true
});
@@ -74,7 +73,7 @@ class MyAccounts extends React.Component {
this.props.dispatch(A.accountRefCreate(customerId, payload))
.then(() => {
- this.close.bind(this);
+ this.close();
return this.props.dispatch(A.fetchOwnAccounts(customerId));
})
.catch(err => {
@@ -94,7 +93,9 @@ class MyAccounts extends React.Component {
remove3rdPartyAccountModalConfirmed(accountId) {
const { customerId } = this.props;
this.props.dispatch(A.deleteAccount(customerId, accountId))
- .then(this.close.bind(this),
+ .then(() => {
+ this.close();
+ },
err => {
this.props.dispatch(A.errorMessageTimedOut(err && err.message || err));
this.close();
@@ -134,7 +135,11 @@ class MyAccounts extends React.Component {
zipCode
} = address;
- const { showAccountModal, show3rdPartyAccountModal, showDeleteAccountModal } = this.state;
+ const {
+ showAccountModal,
+ show3rdPartyAccountModal,
+ showDeleteAccountModal } = this.state;
+
const { accountToRemove = null} = this.state;
const { error } = this.props;
@@ -182,6 +187,10 @@ class MyAccounts extends React.Component {
));
+ const accounts = (!!(ownAccounts.length + refAccounts.length)) ? [].concat(ownAccounts, refAccounts) : (
+ | No account exists: or |
+
);
+
return (
@@ -223,6 +232,7 @@ class MyAccounts extends React.Component {
+
@@ -232,8 +242,7 @@ class MyAccounts extends React.Component {
- { ownAccounts }
- { refAccounts }
+ { accounts }
diff --git a/js-frontend/src/views/modals/NewAccountModal.js b/js-frontend/src/views/modals/NewAccountModal.js
index 751e87b..a0763d4 100644
--- a/js-frontend/src/views/modals/NewAccountModal.js
+++ b/js-frontend/src/views/modals/NewAccountModal.js
@@ -50,25 +50,10 @@ const formValidation = (payload) => ['title', 'balance', 'description'].reduce((
export class NewAccountModal extends React.Component {
static propTypes = {
- inputProps: PropTypes.shape({
- title: PropTypes.object,
- balance: PropTypes.object,
- description: PropTypes.object,
- submit: PropTypes.object
- }),
action: PropTypes.func,
account: PropTypes.object.isRequired
};
-
- static defaultProps = {
- inputProps: {
- title: {},
- balance: {},
- description: {},
- submit: {}
- }
- };
-
+
handleSubmit(event) {
event.preventDefault();
@@ -156,7 +141,7 @@ export class NewAccountModal extends React.Component {
icon={}
disabled={disabled}
onClick={this.handleSubmit.bind(this)}
- {...this.props.inputProps.submit}>
+ >
{actionLabel}