mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: hide file explorer when auth error occurs
This commit is contained in:
parent
063a7edfa3
commit
7e57bf3812
2 changed files with 8 additions and 3 deletions
|
|
@ -94,9 +94,10 @@ export default class Gitako extends React.PureComponent {
|
|||
return (
|
||||
<div className={'gitako-side-bar-content'}>
|
||||
{metaData && <MetaBar metaData={metaData} />}
|
||||
{errorDueToAuth && this.renderAccessDeniedError()}
|
||||
{metaData &&
|
||||
<FileExplorer metaData={metaData} treeData={treeData} freeze={showSettings} accessToken={accessToken} compressSingletonFolder={compressSingletonFolder} />
|
||||
{errorDueToAuth
|
||||
? this.renderAccessDeniedError()
|
||||
: metaData &&
|
||||
<FileExplorer metaData={metaData} treeData={treeData} freeze={showSettings} accessToken={accessToken} compressSingletonFolder={compressSingletonFolder} />
|
||||
}
|
||||
</div>
|
||||
)
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ const handleError = dispatch => async (err) => {
|
|||
const repoPageType = await DOMHelper.getRepoPageType()
|
||||
const errorDueToAuth = repoPageType === REPO_TYPE_PRIVATE || err.message === BAD_CREDENTIALS
|
||||
dispatch({ errorDueToAuth })
|
||||
dispatch(setShowSettings, true)
|
||||
dispatch(setShouldShow, errorDueToAuth)
|
||||
if (!errorDueToAuth) {
|
||||
dispatch(setError, 'Gitako ate a bug, but it should recovery soon!')
|
||||
|
|
@ -107,6 +108,8 @@ const setError = dispatch => error => {
|
|||
|
||||
const toggleShowSettings = dispatch => () => dispatch(({ showSettings }) => ({ showSettings: !showSettings }))
|
||||
|
||||
const setShowSettings = dispatch => showSettings => dispatch({ showSettings })
|
||||
|
||||
const onAccessTokenChange = dispatch => accessToken => dispatch({ accessToken })
|
||||
|
||||
const onShortcutChange = dispatch => shortcut => dispatch({ toggleShowSideBarShortcut: shortcut })
|
||||
|
|
@ -120,6 +123,7 @@ export default {
|
|||
onPJAXEnd,
|
||||
onKeyDown,
|
||||
setShouldShow,
|
||||
setShowSettings,
|
||||
toggleShowSideBar,
|
||||
toggleShowSettings,
|
||||
onAccessTokenChange,
|
||||
|
|
|
|||
Loading…
Reference in a new issue