hino / app / services / home-notification.js
home-notification.js
Raw
import RSVP from 'rsvp';
import Service, { inject as service } from '@ember/service';

export default Service.extend({
	store: service(),

	model: null,
	init() {
        this._super(...arguments);
    },
	setModel(data) {
		this.set("model", data);
	},

	refreshHomeNotification() {
		return new RSVP.Promise((resolve, reject) => {
			return this.store.queryRecord('home-notification', {
				me: true
			}).then(notification => {
				this.set('model', notification);
				resolve();
			}, reject);
		});
	}
});