From 5153feae40ca7fa875c13ac200a30be65c46769e Mon Sep 17 00:00:00 2001 From: Jayasanka Date: Thu, 10 Oct 2019 11:04:43 +0530 Subject: [PATCH] Fix login redirection issue in APPM Store UI --- .../react-app/src/pages/Login.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js index 354ef62167..3f1ff09306 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.ui/react-app/src/pages/Login.js @@ -98,13 +98,18 @@ class NormalLoginForm extends React.Component { const request = Object.keys(parameters).map(key => key + '=' + parameters[key]).join('&'); - axios.post(window.location.origin+ config.serverConfig.loginUri, request + axios.post(window.location.origin + config.serverConfig.loginUri, request ).then(res => { if (res.status === 200) { - window.location = window.location.origin+ "/store"; + let redirectUrl = window.location.origin + "/store"; + const searchParams = new URLSearchParams(window.location.search); + if (searchParams.has("redirect")) { + redirectUrl = searchParams.get("redirect"); + } + window.location = redirectUrl; } }).catch(function (error) { - handleApiError(error,"Error occurred while trying to load groups."); + handleApiError(error, "Error occurred while trying to load groups."); if (error.hasOwnProperty("response") && error.response.status === 400) { thisForm.setState({ inValid: true, @@ -158,7 +163,8 @@ class NormalLoginForm extends React.Component { )}
Forgot password -