change 401 redirection in APPM publisher Ui

4.x.x
Jayasanka 6 years ago
parent 92fd8a62be
commit a9de6af5f7

@ -4,6 +4,7 @@
"value": "lightBaseTheme"
},
"serverConfig": {
"protocol": "https",
"hostname": "localhost",
"httpsPort": "9443",
"invokerUri": "/api/application-mgt-handler/v1.0/invoke",

@ -30,7 +30,7 @@ class DetailedRating extends React.Component{
getData = (uuid)=>{
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-store/v1.0/reviews/"+uuid+"/rating";
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
let detailedRating = res.data.data;
@ -41,7 +41,7 @@ class DetailedRating extends React.Component{
}).catch(function (error) {
if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/store/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
}
});
};

@ -120,7 +120,7 @@ class ConnectedAppsTable extends React.Component {
const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&');
console.log(request);
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
let apps = [];
@ -143,7 +143,7 @@ class ConnectedAppsTable extends React.Component {
}).catch((error) => {
if (error.response.status === 401) {
message.error('You are not logged in');
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.error('Something went wrong... :(');
}

@ -21,7 +21,7 @@ class ManageCategories extends React.Component {
componentDidMount() {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/categories";
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
let categories = JSON.parse(res.data.data);
@ -33,7 +33,7 @@ class ManageCategories extends React.Component {
}).catch((error) => {
if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
@ -56,7 +56,7 @@ class ManageCategories extends React.Component {
loading: true
});
const request = "method=delete&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories/" + id;
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
notification["success"]({
@ -83,7 +83,7 @@ class ManageCategories extends React.Component {
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
}
@ -198,7 +198,7 @@ class ManageCategories extends React.Component {
const dataArray = JSON.stringify(tempElements.map(category => category.categoryName));
const request = "method=post&content-type=application/json&payload=" + dataArray + "&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories";
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
notification["success"]({
@ -220,7 +220,7 @@ class ManageCategories extends React.Component {
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
}
@ -259,7 +259,7 @@ class ManageCategories extends React.Component {
isEditModalVisible: false,
});
const request = "method=put&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories/rename?from="+currentlyEditingId+"%26to="+editingValue;
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
notification["success"]({
@ -280,7 +280,7 @@ class ManageCategories extends React.Component {
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
}

@ -21,7 +21,7 @@ class ManageTags extends React.Component {
componentDidMount() {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/tags";
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
let categories = JSON.parse(res.data.data);
@ -33,7 +33,7 @@ class ManageTags extends React.Component {
}).catch((error) => {
if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
@ -56,7 +56,7 @@ class ManageTags extends React.Component {
loading: true
});
const request = "method=delete&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories/" + id;
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
notification["success"]({
@ -81,7 +81,7 @@ class ManageTags extends React.Component {
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
}
@ -196,7 +196,7 @@ class ManageTags extends React.Component {
const dataArray = JSON.stringify(tempElements.map(category => category.categoryName));
const request = "method=post&content-type=application/json&payload=" + dataArray + "&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories";
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
notification["success"]({
@ -218,7 +218,7 @@ class ManageTags extends React.Component {
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
}
@ -257,7 +257,7 @@ class ManageTags extends React.Component {
isEditModalVisible: false,
});
const request = "method=put&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/admin/applications/categories?from="+currentlyEditingId+"%26to="+editingValue;
axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
notification["success"]({
@ -278,7 +278,7 @@ class ManageTags extends React.Component {
}).catch((error) => {
if (error.response.hasOwnProperty("status") && error.response.status === 401) {
message.error('You are not logged in');
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else {
message.warning('Something went wrong');
}

@ -6,7 +6,7 @@ export const getApps = () => dispatch => {
const request = "method=post&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications";
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
let apps = [];
@ -19,7 +19,7 @@ export const getApps = () => dispatch => {
}).catch(function (error) {
if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
}
});
@ -29,7 +29,7 @@ export const getRelease = (uuid) => dispatch => {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/release/" + uuid;
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
let release = res.data.data;
@ -38,7 +38,7 @@ export const getRelease = (uuid) => dispatch => {
}).catch(function (error) {
if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
}
});
@ -73,7 +73,7 @@ export const closeLifecycleModal = () => dispatch => {
export const getLifecycle = () => dispatch => {
const request = "method=get&content-type=application/json&payload={}&api-endpoint=/application-mgt-publisher/v1.0/applications/lifecycle-config";
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 200) {
let lifecycle = res.data.data;
@ -82,7 +82,7 @@ export const getLifecycle = () => dispatch => {
}).catch(function (error) {
if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
}
});
};
@ -97,7 +97,7 @@ export const updateLifecycleState = (uuid, nextState, reason) => dispatch => {
const request = "method=post&content-type=application/json&payload=" + JSON.stringify(payload) + "&api-endpoint=/application-mgt-publisher/v1.0/applications/life-cycle/" + uuid;
return axios.post('https://' + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
return axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname + ':' + config.serverConfig.httpsPort + config.serverConfig.invokerUri, request
).then(res => {
if (res.status === 201) {
let release = res.data.data;
@ -111,7 +111,7 @@ export const updateLifecycleState = (uuid, nextState, reason) => dispatch => {
}).catch(function (error) {
if (error.response.status === 401) {
window.location.href = 'https://localhost:9443/publisher/login';
window.location.href = config.serverConfig.protocol + "://" + config.serverConfig.hostname + ':' + config.serverConfig.httpsPort+'/publisher/login';
} else if (error.response.status === 500) {
alert("error");
dispatch({

@ -59,7 +59,7 @@ class NormalLoginForm extends React.Component {
});
console.log('Received values of form: ', values);
let data = "username=" + values.username + "&password=" + values.password + "&platform=publisher";
axios.post('https://'+config.serverConfig.hostname+':'+config.serverConfig.httpsPort+config.serverConfig.loginUri, data
axios.post(config.serverConfig.protocol + "://"+config.serverConfig.hostname+':'+config.serverConfig.httpsPort+config.serverConfig.loginUri, data
).then(res => {
if (res.status === 200) {
window.location = res.data.url;

Loading…
Cancel
Save