mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
fix: sigin in different window may not refresh workspace list (#4270)
Co-authored-by: Alex Yang <himself65@outlook.com>
This commit is contained in:
@@ -2,9 +2,7 @@ import {
|
||||
AuthModal as AuthModalBase,
|
||||
type AuthModalProps as AuthModalBaseProps,
|
||||
} from '@affine/component/auth-components';
|
||||
import { refreshRootMetadataAtom } from '@affine/workspace/atom';
|
||||
import { useSetAtom } from 'jotai';
|
||||
import { type FC, startTransition, useCallback, useMemo } from 'react';
|
||||
import { type FC, useCallback, useMemo } from 'react';
|
||||
|
||||
import { AfterSignInSendEmail } from './after-sign-in-send-email';
|
||||
import { AfterSignUpSendEmail } from './after-sign-up-send-email';
|
||||
@@ -60,14 +58,9 @@ export const AuthModal: FC<AuthModalBaseProps & AuthProps> = ({
|
||||
setEmailType,
|
||||
emailType,
|
||||
}) => {
|
||||
const refreshMetadata = useSetAtom(refreshRootMetadataAtom);
|
||||
|
||||
const onSignedIn = useCallback(() => {
|
||||
setOpen(false);
|
||||
startTransition(() => {
|
||||
refreshMetadata();
|
||||
});
|
||||
}, [refreshMetadata, setOpen]);
|
||||
}, [setOpen]);
|
||||
|
||||
return (
|
||||
<AuthModalBase open={open} setOpen={setOpen}>
|
||||
|
||||
@@ -4,10 +4,8 @@ import {
|
||||
BackButton,
|
||||
ModalHeader,
|
||||
} from '@affine/component/auth-components';
|
||||
import { pushNotificationAtom } from '@affine/component/notification-center';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
import { Button } from '@toeverything/components/button';
|
||||
import { useSetAtom } from 'jotai';
|
||||
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
||||
import { useSession } from 'next-auth/react';
|
||||
import type { FC } from 'react';
|
||||
@@ -25,8 +23,6 @@ export const SignInWithPassword: FC<AuthPanelProps> = ({
|
||||
const t = useAFFiNEI18N();
|
||||
const { update } = useSession();
|
||||
|
||||
const pushNotification = useSetAtom(pushNotificationAtom);
|
||||
|
||||
const [password, setPassword] = useState('');
|
||||
const [passwordError, setPasswordError] = useState(false);
|
||||
|
||||
@@ -43,12 +39,7 @@ export const SignInWithPassword: FC<AuthPanelProps> = ({
|
||||
|
||||
await update();
|
||||
onSignedIn?.();
|
||||
pushNotification({
|
||||
title: t['com.affine.auth.has.signed'](),
|
||||
message: t['com.affine.auth.has.signed.message'](),
|
||||
type: 'success',
|
||||
});
|
||||
}, [email, password, pushNotification, onSignedIn, t, update]);
|
||||
}, [email, password, onSignedIn, update]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import { Modal, ModalWrapper } from '@affine/component';
|
||||
import { Trans } from '@affine/i18n';
|
||||
import { useAFFiNEI18N } from '@affine/i18n/hooks';
|
||||
|
||||
import * as styles from './styles.css';
|
||||
|
||||
export const DesktopLoginModal = ({
|
||||
signingEmail,
|
||||
}: {
|
||||
signingEmail?: string;
|
||||
}) => {
|
||||
const t = useAFFiNEI18N();
|
||||
return (
|
||||
<Modal open={!!signingEmail}>
|
||||
<ModalWrapper className={styles.root}>
|
||||
<div className={styles.title}>
|
||||
{t['com.affine.auth.desktop.signing.in']()}
|
||||
</div>
|
||||
|
||||
<Trans i18nKey="com.affine.auth.desktop.signing.in.message">
|
||||
Signing in with account {signingEmail}
|
||||
</Trans>
|
||||
</ModalWrapper>
|
||||
</Modal>
|
||||
);
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
import { style } from '@vanilla-extract/css';
|
||||
|
||||
export const root = style({
|
||||
padding: '20px 24px',
|
||||
});
|
||||
|
||||
export const title = style({
|
||||
fontSize: 'var(--affine-font-h-6)',
|
||||
fontWeight: 600,
|
||||
marginBottom: 12,
|
||||
});
|
||||
Reference in New Issue
Block a user