From 1b1338fed680f13bb8128258efe87aa2a0cea4d4 Mon Sep 17 00:00:00 2001
From: Ildar Kamalov <i.kamalov@adguard.com>
Date: Mon, 20 Jan 2020 18:34:22 +0300
Subject: [PATCH] + client: use relative URLs for login/logout

---
 client/src/actions/login.js           | 3 ++-
 client/src/components/Header/index.js | 6 +++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/client/src/actions/login.js b/client/src/actions/login.js
index 90cc0780..04e81b03 100644
--- a/client/src/actions/login.js
+++ b/client/src/actions/login.js
@@ -11,7 +11,8 @@ export const processLogin = values => async (dispatch) => {
     dispatch(processLoginRequest());
     try {
         await apiClient.login(values);
-        window.location.replace(window.location.origin);
+        const dashboardUrl = window.location.origin + window.location.pathname.replace('/login.html', '/');
+        window.location.replace(dashboardUrl);
         dispatch(processLoginSuccess());
     } catch (error) {
         dispatch(addErrorToast({ error }));
diff --git a/client/src/components/Header/index.js b/client/src/components/Header/index.js
index 9bd99920..12373b9e 100644
--- a/client/src/components/Header/index.js
+++ b/client/src/components/Header/index.js
@@ -61,9 +61,9 @@ class Header extends Component {
                         <div className="header__column">
                             <div className="header__right">
                                 {!dashboard.processingProfile && dashboard.name &&
-                                <a href="/control/logout" className="btn btn-sm btn-outline-secondary">
-                                    <Trans>sign_out</Trans>
-                                </a>
+                                    <a href="control/logout" className="btn btn-sm btn-outline-secondary">
+                                        <Trans>sign_out</Trans>
+                                    </a>
                                 }
                             </div>
                         </div>