Ensured mercure updates are not set even if supported, when they have been disabled

This commit is contained in:
Alejandro Celaya
2020-04-25 10:37:50 +02:00
parent 6fcf588bfd
commit 16dee3664b
6 changed files with 26 additions and 12 deletions

View File

@@ -1,9 +1,10 @@
import { EventSourcePolyfill as EventSource } from 'event-source-polyfill';
export const bindToMercureTopic = (mercureInfo, topic, onMessage, onTokenExpired) => () => {
export const bindToMercureTopic = (mercureInfo, realTimeUpdates, topic, onMessage, onTokenExpired) => () => {
const { enabled } = realTimeUpdates;
const { mercureHubUrl, token, loading, error } = mercureInfo;
if (loading || error) {
if (!enabled || loading || error) {
return undefined;
}