mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-04 20:42:52 +00:00
feat: add backend toggle
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
import {CommonModule, HashLocationStrategy, LocationStrategy, registerLocaleData} from '@angular/common';
|
||||
import {HttpClient} from '@angular/common/http';
|
||||
import localeDe from '@angular/common/locales/de';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {NgModule, Provider} from '@angular/core';
|
||||
import {BrowserModule} from '@angular/platform-browser';
|
||||
import {RouteReuseStrategy} from '@angular/router';
|
||||
import {SplashScreen} from '@ionic-native/splash-screen/ngx';
|
||||
@@ -31,6 +31,7 @@ import {DataModule} from './modules/data/data.module';
|
||||
import {MenuModule} from './modules/menu/menu.module';
|
||||
import {SettingsModule} from './modules/settings/settings.module';
|
||||
import {StorageModule} from './modules/storage/storage.module';
|
||||
import {environment} from './../environments/environment';
|
||||
|
||||
registerLocaleData(localeDe);
|
||||
|
||||
@@ -43,6 +44,19 @@ export function createTranslateLoader(http: HttpClient) {
|
||||
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
|
||||
}
|
||||
|
||||
const providers : Provider[] = [
|
||||
StatusBar,
|
||||
SplashScreen,
|
||||
{
|
||||
provide: RouteReuseStrategy,
|
||||
useClass: IonicRouteStrategy,
|
||||
},
|
||||
{
|
||||
provide: LocationStrategy,
|
||||
useClass: HashLocationStrategy,
|
||||
},
|
||||
];
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
@@ -67,19 +81,7 @@ export function createTranslateLoader(http: HttpClient) {
|
||||
},
|
||||
}),
|
||||
],
|
||||
providers: [
|
||||
// use fake backend in place of Http service for backendless development
|
||||
fakeBackendProvider,
|
||||
StatusBar,
|
||||
SplashScreen,
|
||||
{
|
||||
provide: RouteReuseStrategy,
|
||||
useClass: IonicRouteStrategy,
|
||||
},
|
||||
{
|
||||
provide: LocationStrategy,
|
||||
useClass: HashLocationStrategy,
|
||||
},
|
||||
],
|
||||
providers:
|
||||
environment.use_fake_backend ? [providers, fakeBackendProvider] : providers,
|
||||
})
|
||||
export class AppModule {}
|
||||
|
||||
@@ -18,6 +18,7 @@ import {SCSearchQuery, SCSearchResponse, SCThingOriginType, SCThings, SCThingTyp
|
||||
import {SCSaveableThing} from '@openstapps/core';
|
||||
import {StorageProvider} from '../storage/storage.provider';
|
||||
import {StAppsWebHttpClient} from './stapps-web-http-client.provider';
|
||||
import {environment} from './../../../environments/environment';
|
||||
|
||||
export enum DataScope {
|
||||
Local = 'local',
|
||||
@@ -45,7 +46,7 @@ export class DataProvider {
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
backendUrl = 'http://localhost:3000';
|
||||
backendUrl = environment.backend_url;
|
||||
/**
|
||||
* TODO
|
||||
*/
|
||||
|
||||
@@ -15,5 +15,6 @@
|
||||
export const environment = {
|
||||
backend_url: 'http://localhost:3000',
|
||||
backend_version: '1.0.0',
|
||||
use_fake_backend: false,
|
||||
production: true,
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
export const environment = {
|
||||
backend_url: 'http://localhost:3000',
|
||||
backend_version: '1.0.0',
|
||||
use_fake_backend: false,
|
||||
production: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -15,5 +15,6 @@
|
||||
export const environment = {
|
||||
backend_url: 'http://localhost:3000',
|
||||
backend_version: '1.0.0',
|
||||
use_fake_backend: true,
|
||||
production: true,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user