launch: subscribe to invite-view, pass invite data

This commit adds a new subscription to launch and retain the current
tile data prop structure by initialising the data prop as an object
and always appending the invite information to it.
This commit is contained in:
Matilde Park 2020-03-06 17:22:14 -05:00
parent a219014949
commit 95acca9acb
2 changed files with 14 additions and 4 deletions

View File

@ -17,9 +17,15 @@ export default class Home extends Component {
render() {
let keys = [...this.props.keys];
let tileElems = keys.map((tile) => {
return (
<Tile key={tile} type={tile} data={this.props.data[tile]} />
);
let tileData = {};
if (tile in this.props.data && tile !== "invite-initial") {
tileData = this.props.data[tile] !== null
? this.props.data[tile] : {};
tileData["invites"] = ("invite-initial" in this.props.data)
? this.props.data["invite-initial"] : {};
}
return <Tile key={tile} type={tile} data={tileData} />;
});
return (

View File

@ -26,7 +26,11 @@ export class Subscription {
this.handleEvent.bind(this),
this.handleError.bind(this),
ship);
}
api.bind("invite-view", '/primary',
this.handleEvent.bind(this),
this.handleError.bind(this),
ship);
}
handleEvent(diff) {
store.handleEvent(diff);