refactor: move user-related data to appStore

This commit is contained in:
VardanHakobyan
2021-06-16 17:00:13 +04:00
parent 018251838c
commit c897199d33
5 changed files with 10 additions and 31 deletions

View File

@@ -11,20 +11,17 @@ import TargetedKeyboardEvent = JSXInternal.TargetedKeyboardEvent;
import { WebApplication } from '@/ui_models/application';
import { useEffect, useRef, useState } from 'preact/hooks';
import TargetedMouseEvent = JSXInternal.TargetedMouseEvent;
import { User } from '@standardnotes/snjs/dist/@types/services/api/responses';
import { observer } from 'mobx-react-lite';
import { AppState } from '@/ui_models/app_state';
type Props = {
application: WebApplication;
appState: AppState;
user: User | undefined;
}
const Authentication = observer(({
application,
appState,
user
}: Props) => {
const [showAdvanced, setShowAdvanced] = useState(false);
@@ -50,6 +47,8 @@ const Authentication = observer(({
closeAccountMenu
} = appState.accountMenu;
const user = application.getUser();
useEffect(() => {
if (isEmailFocused) {
emailInputRef.current.focus();