diff --git a/renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js b/renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js index afe89eff5..6b2e4c4c2 100644 --- a/renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js +++ b/renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js @@ -63,8 +63,8 @@ function EditorSync({ selectedProject }) { } } catch (err) { logger.debug('EditorSync.js', `Error Sync : ${err}`); - await notifyStatus('failure', err?.message || err); - await addNotification('Sync', err?.message || err, 'failure'); + await notifyStatus('failure', (window?.navigator?.onLine) ? (err?.message || err) : 'Check your internet connection'); + await addNotification('Sync', (window?.navigator?.onLine) ? (err?.message || err) : 'Check your internet connection', 'failure'); } }; diff --git a/renderer/src/components/Sync/Gitea/Gitea.js b/renderer/src/components/Sync/Gitea/Gitea.js index f8ecc0728..2f6b58399 100644 --- a/renderer/src/components/Sync/Gitea/Gitea.js +++ b/renderer/src/components/Sync/Gitea/Gitea.js @@ -8,7 +8,9 @@ import GiteaFileBrowser from './GiteaFileBrowser'; import { environment } from '../../../../environment'; import { createSyncProfile } from '../Scribe/SyncToGiteaUtils'; -const Gitea = ({ setAuth, setRepo, logout }) => { +const Gitea = ({ + setAuth, setRepo, logout, setLogout, +}) => { const [authentication, setAuthentication] = useState(); const [repository, setRepository] = useState(); @@ -39,7 +41,9 @@ const Gitea = ({ setAuth, setRepo, logout }) => { useEffect(() => { if (logout) { setAuthentication(); + setLogout(); } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [logout]); return ( diff --git a/renderer/src/components/Sync/Scribe/SyncToGitea.js b/renderer/src/components/Sync/Scribe/SyncToGitea.js index c3d6e572b..d40d0ec05 100644 --- a/renderer/src/components/Sync/Scribe/SyncToGitea.js +++ b/renderer/src/components/Sync/Scribe/SyncToGitea.js @@ -77,7 +77,7 @@ export async function uploadToGitea(projectDataAg, auth, setSyncProgress, notify if (pushResult === false) { // Auth error / internet error logger.debug('ToGiteaUtils.js', 'Auth failed'); - throw new Error('Something went wrong!'); + throw new Error('Your token expired, do Login again!'); } // pull from remote main to local main const pullStatus = pushResult && await pullProject(fs, projectsMetaPath, mainBranch, auth.token.sha1, localBranch); diff --git a/renderer/src/components/Sync/Sync.js b/renderer/src/components/Sync/Sync.js index cd6fc9f2b..c6375bedb 100644 --- a/renderer/src/components/Sync/Sync.js +++ b/renderer/src/components/Sync/Sync.js @@ -258,7 +258,7 @@ export default function Sync() { - +