mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
Convert AppGateway to be single instance
This commit is contained in:
parent
4a3a368fc5
commit
3c72ee331d
37
js/app.js
37
js/app.js
@ -33,22 +33,8 @@ import NotificationsHandler from './third_party/notifications';
|
|||||||
import FacebookHandler from './third_party/facebook';
|
import FacebookHandler from './third_party/facebook';
|
||||||
/* eslint-enable */
|
/* eslint-enable */
|
||||||
|
|
||||||
initLogging();
|
|
||||||
|
|
||||||
let headers = {
|
const AppGateway = {
|
||||||
'Accept': 'application/json',
|
|
||||||
'Content-Type': 'application/json'
|
|
||||||
};
|
|
||||||
|
|
||||||
requests.defaults({
|
|
||||||
urlMap: ApiUrls,
|
|
||||||
http: {
|
|
||||||
headers: headers,
|
|
||||||
credentials: 'include'
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
class AppGateway {
|
|
||||||
start() {
|
start() {
|
||||||
try {
|
try {
|
||||||
const subdomain = getSubdomain();
|
const subdomain = getSubdomain();
|
||||||
@ -63,7 +49,7 @@ class AppGateway {
|
|||||||
console.logGlobal(err);
|
console.logGlobal(err);
|
||||||
this.load(getDefaultSubdomainSettings());
|
this.load(getDefaultSubdomainSettings());
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
load(settings) {
|
load(settings) {
|
||||||
const { subdomain, type } = settings;
|
const { subdomain, type } = settings;
|
||||||
@ -97,8 +83,21 @@ class AppGateway {
|
|||||||
// Send the applicationDidBoot event to the third-party stores
|
// Send the applicationDidBoot event to the third-party stores
|
||||||
EventActions.applicationDidBoot(settings);
|
EventActions.applicationDidBoot(settings);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
let ag = new AppGateway();
|
// Initialize pre-start components
|
||||||
ag.start();
|
initLogging();
|
||||||
|
|
||||||
|
requests.defaults({
|
||||||
|
urlMap: ApiUrls,
|
||||||
|
http: {
|
||||||
|
headers: {
|
||||||
|
'Accept': 'application/json',
|
||||||
|
'Content-Type': 'application/json'
|
||||||
|
},
|
||||||
|
credentials: 'include'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// And bootstrap app
|
||||||
|
AppGateway.start();
|
||||||
|
Loading…
Reference in New Issue
Block a user