fix: logout will jump to 404 error

This commit is contained in:
DiamondThree
2023-02-07 19:18:28 +08:00
parent a0f5d089d1
commit 028fdae8b1
2 changed files with 44 additions and 21 deletions

View File

@@ -51,9 +51,19 @@ export const LogoutModal = ({ open, onClose }: LoginModalProps) => {
)} )}
{t('Retain local cached data')} {t('Retain local cached data')}
</StyleTips> </StyleTips>
{blobDataSynced ? (
<div> <div>
<Button <Button
type="danger"
shape="round"
style={{ marginRight: '16px' }} style={{ marginRight: '16px' }}
onClick={async () => {
onClose(false);
}}
>
{t('Force Sign Out')}
</Button>
<Button
shape="round" shape="round"
onClick={() => { onClick={() => {
onClose(true); onClose(true);
@@ -61,16 +71,29 @@ export const LogoutModal = ({ open, onClose }: LoginModalProps) => {
> >
{t('Wait for Sync')} {t('Wait for Sync')}
</Button> </Button>
</div>
) : (
<div>
<Button
type="primary"
style={{ marginRight: '16px' }}
shape="round"
onClick={() => {
onClose(true);
}}
>
{t('Cancel')}
</Button>
<Button <Button
type="danger"
shape="round" shape="round"
onClick={() => { onClick={() => {
onClose(false); onClose(false);
}} }}
> >
{t('Force Sign Out')} {t('Sign out')}
</Button> </Button>
</div> </div>
)}
</Content> </Content>
</ModalWrapper> </ModalWrapper>
</Modal> </Modal>

View File

@@ -132,7 +132,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
onClose={async wait => { onClose={async wait => {
if (!wait) { if (!wait) {
await logout(); await logout();
router.replace(`/workspace`); router.push(`/workspace`);
} }
setLogoutOpen(false); setLogoutOpen(false);
}} }}