loading using an Async Thunk

This commit is contained in:
Luke Berndt
2023-01-10 10:14:01 -05:00
parent a2deb4373e
commit 020f00b8fc
4 changed files with 123 additions and 19 deletions

View File

@@ -13,6 +13,7 @@ class ListCalls extends React.Component {
//https://stackoverflow.com/questions/36559661/how-can-i-dispatch-from-child-components-in-react-redux
//https://stackoverflow.com/questions/42597602/react-onclick-pass-event-with-parameter
render() {
const callsData = this.props.callsData;
return (
<Table id="calls" unstackable >
@@ -24,20 +25,24 @@ class ListCalls extends React.Component {
<Table.HeaderCell><Icon name='star' /></Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body >
{callsData != false &&
<Table.Body>
{this.props.callsAllIds.map((callId, index) => {
{
this.props.callsData.ids.map((callId, index) => {
if (callId === this.props.activeCallId) {
return (<Ref innerRef={this.props.currentCallRef} key={index} ><CallItem activeCall={true} call={this.props.callsById[callId]} talkgroups={this.props.talkgroups} key={index} onClick={this.props.playCall}/></Ref>)
return (<Ref innerRef={this.props.currentCallRef} key={index} ><CallItem activeCall={true} call={this.props.callsData.entities[callId]} talkgroups={this.props.talkgroups} key={index} onClick={this.props.playCall}/></Ref>)
} else {
return <CallItem activeCall={false} call={this.props.callsById[callId]} talkgroups={this.props.talkgroups} key={index} onClick={this.props.playCall}/>
return <CallItem activeCall={false} call={this.props.callsData.entities[callId]} talkgroups={this.props.talkgroups} key={index} onClick={this.props.playCall}/>
}
})
}
}
</Table.Body>
}
</Table>
);
}