FIX: hodlhodl - my contracts - sorted by creation time (closes #2037)

This commit is contained in:
Overtorment 2020-11-02 15:57:28 +00:00
parent 5a315b4e56
commit dacd0d6209

View file

@ -112,7 +112,7 @@ export default class HodlHodlMyContracts extends Component {
}); });
const hodlApi = this.state.hodlApi; const hodlApi = this.state.hodlApi;
const contracts = []; let contracts = [];
let contractToDisplay = this.state.contractToDisplay; let contractToDisplay = this.state.contractToDisplay;
const contractIds = await this.context.getHodlHodlContracts(); const contractIds = await this.context.getHodlHodlContracts();
@ -151,6 +151,8 @@ export default class HodlHodlMyContracts extends Component {
} }
} }
contracts = contracts.sort((a, b) => (a.created_at >= b.created_at ? -1 : 1)); // new contracts on top
this.setState({ hodlApi: hodlApi, contracts, contractToDisplay, isLoading: false }); this.setState({ hodlApi: hodlApi, contracts, contractToDisplay, isLoading: false });
} }