feat: add support for runtime server url changes (#1271)
Fixes: #786 Fixes: #1229
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
/** Angular Imports */
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
/** Environment Imports */
|
||||
import { environment } from '../../environments/environment';
|
||||
|
||||
/**
|
||||
* Settings Service
|
||||
*/
|
||||
@@ -27,6 +30,22 @@ export class SettingsService {
|
||||
localStorage.setItem('mifosXLanguage', JSON.stringify(language));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets server URL setting throughout the app.
|
||||
* @param {string} url URL
|
||||
*/
|
||||
setServer(url: string) {
|
||||
localStorage.setItem('mifosXServerURL', JSON.stringify(url));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets server URL setting throughout the app.
|
||||
* @param {string[]} list List of default servers
|
||||
*/
|
||||
setServers(list: string[]) {
|
||||
localStorage.setItem('mifosXServers', JSON.stringify(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns date format setting.
|
||||
*/
|
||||
@@ -41,4 +60,18 @@ export class SettingsService {
|
||||
return JSON.parse(localStorage.getItem('mifosXLanguage'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns list of default server
|
||||
*/
|
||||
get servers() {
|
||||
return JSON.parse(localStorage.getItem('mifosXServers'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns server setting
|
||||
*/
|
||||
get server() {
|
||||
return environment.baseApiUrl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user