|
|
@ -98,19 +98,24 @@ class App extends React.Component {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
checkUserLoggedIn = (config) => {
|
|
|
|
checkUserLoggedIn = (config) => {
|
|
|
|
axios.get(
|
|
|
|
axios.post(
|
|
|
|
window.location.origin + config.serverConfig.invoker.uri +
|
|
|
|
window.location.origin + "/publisher-ui-request-handler/user",
|
|
|
|
config.serverConfig.invoker.publisher + "/applications/categories"
|
|
|
|
"platform=publisher"
|
|
|
|
).then(res => {
|
|
|
|
).then(res => {
|
|
|
|
|
|
|
|
const lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1);
|
|
|
|
|
|
|
|
if (lastURLSegment !== "login") {
|
|
|
|
|
|
|
|
window.location.href = window.location.origin + `/publisher/`;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
this.getAndroidEnterpriseToken(config);
|
|
|
|
this.getAndroidEnterpriseToken(config);
|
|
|
|
|
|
|
|
}
|
|
|
|
}).catch((error) => {
|
|
|
|
}).catch((error) => {
|
|
|
|
if (error.hasOwnProperty("response") && error.response.status === 401) {
|
|
|
|
if (error.hasOwnProperty("response") && error.response.status === 401) {
|
|
|
|
const redirectUrl = encodeURI(window.location.href);
|
|
|
|
const redirectUrl = encodeURI(window.location.href);
|
|
|
|
const pageURL = window.location.pathname;
|
|
|
|
const pageURL = window.location.pathname;
|
|
|
|
const lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1);
|
|
|
|
const lastURLSegment = pageURL.substr(pageURL.lastIndexOf('/') + 1);
|
|
|
|
if(lastURLSegment!=="login"){
|
|
|
|
if (lastURLSegment !== "login") {
|
|
|
|
window.location.href = window.location.origin + `/publisher/login?redirect=${redirectUrl}`;
|
|
|
|
window.location.href = window.location.origin + `/publisher/login?redirect=${redirectUrl}`;
|
|
|
|
}else{
|
|
|
|
} else {
|
|
|
|
this.getAndroidEnterpriseToken(config);
|
|
|
|
this.getAndroidEnterpriseToken(config);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|