mirror of
https://github.com/naturalcrit/homebrewery.git
synced 2026-09-23 18:22:57 +00:00
Add reload when initStream message is received
This commit is contained in:
@@ -66,6 +66,18 @@ const Homebrew = createClass({
|
|||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
componentDidMount : function(){
|
||||||
|
const eventSource = new EventSource('/stream');
|
||||||
|
|
||||||
|
eventSource.addEventListener('message', (evt)=>{
|
||||||
|
const messageData = JSON.parse(evt.data);
|
||||||
|
|
||||||
|
if(messageData.eventType == 'initStream'){
|
||||||
|
window.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
render : function (){
|
render : function (){
|
||||||
return (
|
return (
|
||||||
<Router location={this.props.url}>
|
<Router location={this.props.url}>
|
||||||
|
|||||||
Reference in New Issue
Block a user