DEV: Use Ember.Service over manually registering a factory.

Follow up to 9e827eb420
This commit is contained in:
Guo Xiang Tan
2020-05-06 09:24:49 +08:00
committed by Alan Guo Xiang Tan
parent 4e1c2fbd18
commit b299f5f491
6 changed files with 83 additions and 129 deletions
@@ -28,7 +28,10 @@ export default {
const messageBus = window.MessageBus;
app.register("message-bus:main", messageBus, { instantiate: false });
ALL_TARGETS.forEach(t => app.inject(t, "messageBus", "message-bus:main"));
ALL_TARGETS.concat("service").forEach(t =>
app.inject(t, "messageBus", "message-bus:main")
);
const currentUser = User.current();
app.register("current-user:main", currentUser, { instantiate: false });
@@ -47,7 +50,7 @@ export default {
const siteSettings = app.SiteSettings;
app.register("site-settings:main", siteSettings, { instantiate: false });
ALL_TARGETS.forEach(t =>
ALL_TARGETS.concat("service").forEach(t =>
app.inject(t, "siteSettings", "site-settings:main")
);
@@ -77,7 +80,7 @@ export default {
);
if (currentUser) {
["component", "route", "controller"].forEach(t => {
["component", "route", "controller", "service"].forEach(t => {
app.inject(t, "currentUser", "current-user:main");
});
}