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
This commit is contained in:
Rish 2020-04-28 08:55:24 +05:30
parent 982c9d19ef
commit 4b01a1eac9
2 changed files with 5 additions and 1 deletions

View File

@ -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'

View File

@ -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');
}
});
},