Fixing the store retrieve the backend details from config file.

feature/appm-store/pbac
sinthuja 7 years ago
parent 0989f1ac62
commit b15e532983

@ -20,16 +20,16 @@ package org.wso2.carbon.device.application.mgt.auth.handler.util;
//TODO: Remove hardcoded localhost and ports //TODO: Remove hardcoded localhost and ports
public class Constants { public class Constants {
public static String SCOPES = "perm:application:get perm:application:create perm:application:update " + public static final String SCOPES = "perm:application:get perm:application:create perm:application:update " +
"perm:application-mgt:login perm:application:delete perm:platform:add perm:platform:remove " + "perm:application-mgt:login perm:application:delete perm:platform:add perm:platform:remove " +
"perm:roles:view perm:devices:view perm:platform:get"; "perm:roles:view perm:devices:view perm:platform:get";
public static String[] TAGS = {"device_management"}; public static final String[] TAGS = {"device_management"};
public static String USER_NAME = "userName"; public static final String USER_NAME = "userName";
public static String APPLICATION_NAME = "applicationmgt_publisher"; public static final String APPLICATION_NAME = "applicationmgt_publisher";
public static String TOKEN_ENDPOINT = "https://localhost:8243"; public static final String TOKEN_ENDPOINT = "https://localhost:8243";
public static String PASSWORD_GRANT_TYPE = "password"; public static final String PASSWORD_GRANT_TYPE = "password";
public static String REFRESH_GRANT_TYPE = "refresh_token"; public static final String REFRESH_GRANT_TYPE = "refresh_token";
public static String API_APPLICATION_ENDPOINT = "https://localhost:9443/api-application-registration/"; public static final String API_APPLICATION_ENDPOINT = "https://localhost:9443/api-application-registration/";
public static String APPLICATION_INFO = "application_info"; public static final String APPLICATION_INFO = "application_info";
} }

@ -34,7 +34,7 @@ class Configuration {
loadConfiguration(callback) { loadConfiguration(callback) {
let thisObject = this; let thisObject = this;
axios.get(thisObject.hostConstants.baseURL + "/config.json").then(function (response) { axios.get(thisObject.hostConstants.baseURL + '/' + thisObject.hostConstants.appContext + "/config.json").then(function (response) {
thisObject.serverConfig = response.data.config; thisObject.serverConfig = response.data.config;
Constants.load(); Constants.load();
callback(); callback();
@ -45,4 +45,4 @@ class Configuration {
} }
export default (new Configuration); export default (new Configuration());

@ -28,9 +28,8 @@ import Configuration from './common/configuration';
function loadStore() { function loadStore() {
const possibleLocale = navigator.language.split("-")[0]; const possibleLocale = navigator.language.split("-")[0];
//TODO: baseURL: Configuration.hostConstants.baseURL + "/" + Configuration.hostConstants.appContext + "/locales/"
let loadLocaleFile = Axios.create({ let loadLocaleFile = Axios.create({
baseURL: Configuration.hostConstants.baseURL + "/locales/" baseURL: Configuration.hostConstants.baseURL + "/" + Configuration.hostConstants.appContext + "/locales/"
+ possibleLocale + ".json" + possibleLocale + ".json"
}).get(); }).get();
@ -47,7 +46,8 @@ function loadStore() {
}).catch(error => { }).catch(error => {
addLocaleData(require('react-intl/locale-data/en')); addLocaleData(require('react-intl/locale-data/en'));
let defaultLocale = Axios.create({ let defaultLocale = Axios.create({
baseURL: Configuration.hostConstants.baseURL + "/" + "locales/" + Constants.defaultLocale + ".json" baseURL: Configuration.hostConstants.baseURL + "/" + Configuration.hostConstants.appContext + "/locales"
+ Constants.defaultLocale + ".json"
}).get(); }).get();
defaultLocale.then(response => { defaultLocale.then(response => {
const messages = defineMessages(response.data); const messages = defineMessages(response.data);

Loading…
Cancel
Save