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:
parent
c4404bc7b0
commit
e25fb2dce5
1 changed files with 40 additions and 0 deletions
40
app/app/services/app-meta.js
Normal file
40
app/app/services/app-meta.js
Normal 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);
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue