1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-08 06:55:28 +02:00

Create app-meta.js

This commit is contained in:
Harvey Kandola 2016-06-25 10:37:44 -07:00 committed by zinyando
parent c4404bc7b0
commit e25fb2dce5

View file

@ -0,0 +1,40 @@
import Ember from 'ember';
import config from '../config/environment';
const {
String: { htmlSafe },
RSVP: { resolve },
inject: { service }
} = Ember;
export default Ember.Service.extend({
ajax: service(),
url: `${config.apiHost}/${config.apiNamespace}`,
orgId: '',
title: '',
version: '',
message: '',
allowAnonymousAccess: false,
boot() {
let dbhash;
if (is.not.null(document.head.querySelector("[property=dbhash]"))) {
dbhash = document.head.querySelector("[property=dbhash]").content;
}
let isInSetupMode = dbhash && dbhash !== "{{.DBhash}}";
if (isInSetupMode) {
this.setProperites({
title: htmlSafe("Documize Setup"),
allowAnonymousAccess: false
});
return resolve();
}
return this.get('ajax').request('public/meta')
.then((response) => {
this.setProperties(response);
});
}
});