tfabrica
Version:
library for TFabrica - TechSol
78 lines (63 loc) • 2.35 kB
text/typescript
import { TfabricaDictionary } from './tfabrica.dictionary.model';
export class TfabricaSettingsData {
public basePath: string = "";
public properties: TfabricaDictionary[];
public mainAppUrl: string = "/";
public authenticationApiUrl: string = "/api/Auth/Authenticate";
public translationsApiUrl: string = "/api/Config/Translations?lang=";
public supportedLanguagesApiUrl: string = "/api/Config/SupportedLanguages";
public userMenuApiUrl: string = "/api/Menu/UserMenu";
public logApiUrl: string = "/api/Log/AddLog";
public appName: string = "tApi";
public appTitle: string = "tFabrica";
constructor() {
this.properties = new Array();
}
public getauthenticationApiUrl() {
if (this.authenticationApiUrl.startsWith("http")) {
return this.authenticationApiUrl;
}
return this.basePath + this.authenticationApiUrl;
}
public gettranslationsApiUrl() {
if (this.translationsApiUrl.startsWith("http")) {
return this.translationsApiUrl;
}
return this.basePath + this.translationsApiUrl;
}
public getsupportedLanguagesApiUrl() {
if (this.supportedLanguagesApiUrl.startsWith("http")) {
return this.supportedLanguagesApiUrl;
}
return this.basePath + this.supportedLanguagesApiUrl;
}
public getuserMenuApiUrl() {
if (this.userMenuApiUrl.startsWith("http")) {
return this.userMenuApiUrl;
}
return this.basePath + this.userMenuApiUrl;
}
public getlogApiUrl() {
if (this.logApiUrl.startsWith("http")) {
return this.logApiUrl;
}
return this.basePath + this.logApiUrl;
}
public getCommonApiValue(key) {
let that = this;
var value = "";
this.properties.forEach(function (property) {
if (property.key == key) {
if (property.value.startsWith("http")) {
value = property.value;
}
value = that.basePath + property.value;
}
});
return value;
}
public getAppTitle() {
if (this.appTitle != "") return this.appTitle;
return this.appName;
}
}