Merge pull request #2047 from BlueWallet/sort-hodlhodl-my-contracts

FIX: hodlhodl - my contracts - sorted by creation time (closes #2037)
This commit is contained in:
GLaDOS 2020-11-02 16:41:40 +00:00 committed by GitHub
commit a27fe63dc6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,7 +112,7 @@ export default class HodlHodlMyContracts extends Component {
});
const hodlApi = this.state.hodlApi;
const contracts = [];
let contracts = [];
let contractToDisplay = this.state.contractToDisplay;
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 });
}