From 4b01a1eac9e6a039a172afe5f67da27cc390f29e Mon Sep 17 00:00:00 2001
From: Rish <zrishabhgarg@gmail.com>
Date: Tue, 28 Apr 2020 08:55:24 +0530
Subject: [PATCH] Fixed eslint no-console error

no issue

- Throws error on signout failure instead of console log
- Disables eslint for data initialization failure to allow logging error to console
---
 ghost/portal/src/components/ParentContainer.js | 4 ++++
 ghost/portal/src/utils/api.js                  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/ghost/portal/src/components/ParentContainer.js b/ghost/portal/src/components/ParentContainer.js
index 12f76e532c..3ea844939a 100644
--- a/ghost/portal/src/components/ParentContainer.js
+++ b/ghost/portal/src/components/ParentContainer.js
@@ -32,7 +32,9 @@ export default class ParentContainer extends React.Component {
             this.GhostApi = setupGhostApi({adminUrl});
             this.fetchData();
         } else {
+            /* eslint-disable no-console */
             console.error(`[Members.js] Failed to initialize, pass a valid admin url.`);
+            /* eslint-enable no-console */
             this.setState({
                 action: 'init:failed:missingAdminUrl'
             });
@@ -53,7 +55,9 @@ export default class ParentContainer extends React.Component {
                 initStatus: 'success'
             });
         } catch (e) {
+            /* eslint-disable no-console */
             console.error(`[Members.js] Failed to fetch site data, please make sure your admin url - ${adminUrl} - is correct.`);
+            /* eslint-enable no-console */
             this.setState({
                 action: 'init:failed:incorrectAdminUrl',
                 initStatus: 'failed'
diff --git a/ghost/portal/src/utils/api.js b/ghost/portal/src/utils/api.js
index c4f1aa2ade..c59fa3729c 100644
--- a/ghost/portal/src/utils/api.js
+++ b/ghost/portal/src/utils/api.js
@@ -104,7 +104,7 @@ function setupGhostApi({adminUrl}) {
                     window.location.reload();
                     return 'Success';
                 } else {
-                    console.log('Failed to signout!', res);
+                    throw new Error('Failed to signout');
                 }
             });
         },