diff --git a/jsapp/js/account/accountSettingsRoute.tsx b/jsapp/js/account/accountSettingsRoute.tsx index 9ce71f32c8..a785f66ea3 100644 --- a/jsapp/js/account/accountSettingsRoute.tsx +++ b/jsapp/js/account/accountSettingsRoute.tsx @@ -7,7 +7,6 @@ import bem, {makeBem} from 'js/bem'; import sessionStore from 'js/stores/session'; import './accountSettings.scss'; import {notify} from 'js/utils'; -import type {AccountResponse} from '../dataInterface'; import {dataInterface} from '../dataInterface'; import AccountFieldsEditor from './accountFieldsEditor.component'; import Avatar from 'js/components/common/avatar'; @@ -39,7 +38,6 @@ const AccountSettings = () => { Partial >({}); - // We're verifying that the user is logged in so we can consider the current account is from a valid logged user const {currentLoggedAccount} = useSession(); useEffect(() => { diff --git a/jsapp/js/tos/tosForm.component.tsx b/jsapp/js/tos/tosForm.component.tsx index 9acc99745e..737f9b7ebc 100644 --- a/jsapp/js/tos/tosForm.component.tsx +++ b/jsapp/js/tos/tosForm.component.tsx @@ -21,7 +21,7 @@ import type { AccountFieldsErrors, } from 'js/account/account.constants'; import {currentLang, notify} from 'js/utils'; -import {useLocalObservable} from 'mobx-react'; +import {useSession} from '../stores/useSession'; /** A slug for the `sitewide_messages` endpoint */ const TOS_SLUG = 'terms_of_service'; @@ -72,9 +72,7 @@ export default function TOSForm() { fieldsToShow.push('newsletter_subscription'); } - const currentAccount = useLocalObservable( - () => sessionStore.currentAccount as AccountResponse - ); + const {currentLoggedAccount} = useSession(); // Get TOS message from endpoint useEffect(() => { @@ -117,7 +115,7 @@ export default function TOSForm() { // (including the non-required ones that will be hidden, but passed to the API // so that they will not get erased). useEffect(() => { - if (!currentAccount) { + if (!currentLoggedAccount) { return; } @@ -138,7 +136,7 @@ export default function TOSForm() { instagram: data.extra_details.instagram, newsletter_subscription: data.extra_details.newsletter_subscription, }); - }, [currentAccount]); + }, [currentLoggedAccount]); const onFieldChange = (fieldName: string, value: string | boolean) => { setFormFields({