Skip to content

Commit e125dff

Browse files
authored
Merge pull request #15 from eatonphil/billing-dashboard
Patch
2 parents 3269495 + 7ff3b21 commit e125dff

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

src/api/account.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import { actions } from './configs/account';
44

55
export function transferPool() {
66
return async (dispatch) => {
7-
const _transferpool = await dispatch(
8-
thunkFetch.get('/account/transfer')
9-
);
10-
dispatch(actions.one({ _transferpool }, 0));
7+
const _transferpool = await dispatch(thunkFetch.get('/account/transfer'));
8+
dispatch(actions.one({ _transferpool }));
119
};
1210
}

src/api/apiResultActionReducerGenerator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export function generateDefaultStateOne(config, one) {
118118
export class ReducerGenerator {
119119
static one(config, oldStateMany, action) {
120120
if (config.singular) {
121-
return action.resource;
121+
return { ...oldStateMany, ...action.resource };
122122
}
123123

124124
const nonNanActionIds = (action.ids || []).filter(i => !_.isNaN(i));

src/billing/layouts/DashboardPage.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,9 @@ import { Table } from 'linode-components/tables';
88
import { LinkCell } from 'linode-components/tables/cells';
99

1010
import { setSource } from '~/actions/source';
11-
import { account, invoices } from '~/api';
1211

1312

1413
export class DashboardPage extends Component {
15-
static async preload({ dispatch }) {
16-
await dispatch(account.one());
17-
await dispatch(invoices.all());
18-
}
19-
2014
componentDidMount() {
2115
const { dispatch } = this.props;
2216
dispatch(setSource(__filename));

src/billing/layouts/IndexPage.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ import { push } from 'react-router-redux';
55
import { Tabs } from 'linode-components/tabs';
66

77
import { setAnalytics, setTitle } from '~/actions';
8+
import { account, invoices } from '~/api';
89

910

1011
export class IndexPage extends Component {
12+
static async preload({ dispatch }) {
13+
await Promise.all([account.one(), invoices.all()].map(r => dispatch(r)));
14+
}
15+
1116
componentDidMount() {
1217
const { dispatch } = this.props;
1318
dispatch(setTitle('Billing'));

0 commit comments

Comments
 (0)