Skip to content

Commit

Permalink
fixing login issue
Browse files Browse the repository at this point in the history
  • Loading branch information
vipinpaul committed Nov 20, 2023
1 parent fcfaa37 commit de5022f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions renderer/src/components/Sync/Gitea/EditorSync/EditorSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
};

Expand Down
6 changes: 5 additions & 1 deletion renderer/src/components/Sync/Gitea/Gitea.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -39,7 +41,9 @@ const Gitea = ({ setAuth, setRepo, logout }) => {
useEffect(() => {
if (logout) {
setAuthentication();
setLogout();
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [logout]);

return (
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/components/Sync/Scribe/SyncToGitea.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion renderer/src/components/Sync/Sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ export default function Sync() {
</div>

</div>
<Gitea setAuth={setAuth} setRepo={setRepo} logout={logout} />
<Gitea setAuth={setAuth} setRepo={setRepo} logout={logout} setLogout={setLogout} />
</div>
</div>

Expand Down

0 comments on commit de5022f

Please sign in to comment.