Hooks: get rid of useAccount, create useOwnAccount
This commit is contained in:
parent
2da31341c4
commit
be690255cb
3 changed files with 6 additions and 6 deletions
|
@ -6,7 +6,7 @@ import { Link } from 'react-router-dom';
|
|||
|
||||
import { Avatar, Button, Icon } from 'soapbox/components/ui';
|
||||
import Search from 'soapbox/features/compose/components/search';
|
||||
import { useAccount, useSoapboxConfig, useSettings } from 'soapbox/hooks';
|
||||
import { useOwnAccount, useSoapboxConfig, useSettings } from 'soapbox/hooks';
|
||||
|
||||
import { openSidebar } from '../../../actions/sidebar';
|
||||
|
||||
|
@ -16,7 +16,7 @@ const Navbar = () => {
|
|||
const dispatch = useDispatch();
|
||||
const node = React.useRef(null);
|
||||
|
||||
const account = useAccount();
|
||||
const account = useOwnAccount();
|
||||
const settings = useSettings();
|
||||
const soapboxConfig = useSoapboxConfig();
|
||||
const singleUserMode = soapboxConfig.get('singleUserMode');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export { useAccount } from './useAccount';
|
||||
export { useAppSelector } from './useAppSelector';
|
||||
export { useOnScreen } from './useOnScreen';
|
||||
export { useOwnAccount } from './useOwnAccount';
|
||||
export { useSettings } from './useSettings';
|
||||
export { useSoapboxConfig } from './useSoapboxConfig';
|
||||
|
|
|
@ -7,7 +7,7 @@ import type Account from 'soapbox/types/entities/account';
|
|||
// FIXME: getAccount() has the wrong type??
|
||||
const getAccount: (state: any, accountId: any) => any = makeGetAccount();
|
||||
|
||||
/** Get an account from the store (by default, your own account) */
|
||||
export const useAccount = (accountId?: string): Account => {
|
||||
return useAppSelector((state) => getAccount(state, accountId || state.me));
|
||||
/** Get the logged-in account from the store, if any */
|
||||
export const useOwnAccount = (): Account | null => {
|
||||
return useAppSelector((state) => getAccount(state, state.me));
|
||||
};
|
Loading…
Reference in a new issue