mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-31 17:19:56 +08:00
refactor(auth): authenticate user in main window (#8032)
This commit is contained in:
@@ -13,8 +13,8 @@ import type { ReactElement } from 'react';
|
||||
import { useCallback, useEffect } from 'react';
|
||||
|
||||
import type { SettingAtom } from '../atoms';
|
||||
import { authAtom, openSettingModalAtom, openSignOutModalAtom } from '../atoms';
|
||||
import { AuthModal as Auth } from '../components/affine/auth';
|
||||
import { openSettingModalAtom, openSignOutModalAtom } from '../atoms';
|
||||
import { AuthModal } from '../components/affine/auth';
|
||||
import { AiLoginRequiredModal } from '../components/affine/auth/ai-login-required';
|
||||
import { HistoryTipsModal } from '../components/affine/history-tips-modal';
|
||||
import { IssueFeedbackModal } from '../components/affine/issue-feedback-modal';
|
||||
@@ -88,46 +88,6 @@ export const Setting = () => {
|
||||
);
|
||||
};
|
||||
|
||||
export const AuthModal = (): ReactElement => {
|
||||
const [
|
||||
{ openModal, state, email = '', emailType = 'changePassword' },
|
||||
setAuthAtom,
|
||||
] = useAtom(authAtom);
|
||||
|
||||
return (
|
||||
<Auth
|
||||
open={openModal}
|
||||
state={state}
|
||||
email={email}
|
||||
emailType={emailType}
|
||||
setEmailType={useCallback(
|
||||
emailType => {
|
||||
setAuthAtom(prev => ({ ...prev, emailType }));
|
||||
},
|
||||
[setAuthAtom]
|
||||
)}
|
||||
setOpen={useCallback(
|
||||
open => {
|
||||
setAuthAtom(prev => ({ ...prev, openModal: open }));
|
||||
},
|
||||
[setAuthAtom]
|
||||
)}
|
||||
setAuthState={useCallback(
|
||||
state => {
|
||||
setAuthAtom(prev => ({ ...prev, state }));
|
||||
},
|
||||
[setAuthAtom]
|
||||
)}
|
||||
setAuthEmail={useCallback(
|
||||
email => {
|
||||
setAuthAtom(prev => ({ ...prev, email }));
|
||||
},
|
||||
[setAuthAtom]
|
||||
)}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
export function CurrentWorkspaceModals() {
|
||||
const currentWorkspace = useService(WorkspaceService).workspace;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user