From ba5b79451b9f0cf023e511a087259923fe5e9aea Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Tue, 5 May 2015 17:05:02 +0930 Subject: [PATCH] Simplify model registration --- framework/core/js/lib/initializers/store.js | 12 ++++++------ framework/core/js/lib/store.js | 4 ---- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/framework/core/js/lib/initializers/store.js b/framework/core/js/lib/initializers/store.js index ac48edf52..3233aa032 100644 --- a/framework/core/js/lib/initializers/store.js +++ b/framework/core/js/lib/initializers/store.js @@ -9,10 +9,10 @@ import Notification from 'flarum/models/notification'; export default function(app) { app.store = new Store(); - app.store.model('users', User); - app.store.model('discussions', Discussion); - app.store.model('posts', Post); - app.store.model('groups', Group); - app.store.model('activity', Activity); - app.store.model('notifications', Notification); + app.store.models['users'] = User; + app.store.models['discussions'] = Discussion; + app.store.models['posts'] = Post; + app.store.models['groups'] = Group; + app.store.models['activity'] = Activity; + app.store.models['notifications'] = Notification; }; diff --git a/framework/core/js/lib/store.js b/framework/core/js/lib/store.js index 165ecb968..5aba8835c 100644 --- a/framework/core/js/lib/store.js +++ b/framework/core/js/lib/store.js @@ -55,10 +55,6 @@ export default class Store { return data ? Object.keys(data).map(id => data[id]) : []; } - model(type, Model) { - this.models[type] = Model; - } - createRecord(type, data) { data = data || {}; data.type = data.type || type;