FIX: when banner is removed update all clients

Previously removing a banner raised a null "banner" in the message bus
channel.

Then Ember.Object.create would fail cause it always expects an object in
constructor.
This commit is contained in:
Sam Saffron 2019-04-10 15:59:18 +10:00
parent bac1bcc79f
commit 88f8c9f43e
1 changed files with 2 additions and 2 deletions

View File

@ -5,7 +5,7 @@ export default {
after: "message-bus", after: "message-bus",
initialize(container) { initialize(container) {
const banner = Ember.Object.create(PreloadStore.get("banner")), const banner = Ember.Object.create(PreloadStore.get("banner") || {}),
site = container.lookup("site:main"); site = container.lookup("site:main");
site.set("banner", banner); site.set("banner", banner);
@ -16,7 +16,7 @@ export default {
} }
messageBus.subscribe("/site/banner", function(ban) { messageBus.subscribe("/site/banner", function(ban) {
site.set("banner", Ember.Object.create(ban)); site.set("banner", Ember.Object.create(ban || {}));
}); });
} }
}; };