diff --git a/application/app.py b/application/app.py index c2da20b..ad559b3 100644 --- a/application/app.py +++ b/application/app.py @@ -179,7 +179,8 @@ def create_account(): return jsonify(message="Account with that IBAN already exists"), 409 return jsonify( - id=account.id + id=account.id, + balances=get_balances() ) @@ -202,7 +203,7 @@ def edit_account(): return jsonify(message="Account with that IBAN already exists"), 409 return jsonify( - id=account.first().id + balances=get_balances() ) diff --git a/static/src/actions/accounts.js b/static/src/actions/accounts.js index 015daf6..66ab7a4 100644 --- a/static/src/actions/accounts.js +++ b/static/src/actions/accounts.js @@ -10,6 +10,7 @@ import { edit_account, delete_account } from '../utils/http_functions' +import { receiveBalancesData } from './balances' import { logoutAndRedirect } from './auth' export function receiveAccountsData(data) { @@ -66,6 +67,7 @@ export function createAccount(token, account) { .then(parseJSON) .then(response => { dispatch(selectAccount(response.id)) + dispatch(receiveBalancesData(response.balances)) }) .catch(error => { if (error.status === 401) { @@ -87,7 +89,9 @@ export function editAccount(token, account) { account.projected_date ) .then(parseJSON) - .then(response => {}) + .then(response => { + dispatch(receiveBalancesData(response.balances)) + }) .catch(error => { if (error.status === 401) { dispatch(logoutAndRedirect(error)) diff --git a/static/src/components/AccountsSideList/index.js b/static/src/components/AccountsSideList/index.js index e6dc388..57fc7ad 100644 --- a/static/src/components/AccountsSideList/index.js +++ b/static/src/components/AccountsSideList/index.js @@ -130,14 +130,12 @@ export default class AccountsSideList extends React.Component { createAccount(account) { const token = this.props.token this.props.createAccount(token, account) - this.props.updateBalance() this.fetchData() } editAccount(account) { const token = this.props.token this.props.editAccount(token, account) - this.props.updateBalance() this.fetchData() }