bigbuffet-rw/app/soapbox/hooks/useOwnAccount.ts

14 lines
538 B
TypeScript
Raw Normal View History

import { useAppSelector } from 'soapbox/hooks';
import { makeGetAccount } from 'soapbox/selectors';
import type { Account } from 'soapbox/types/entities';
// FIXME: There is no reason this selector shouldn't be global accross the whole app
// FIXME: getAccount() has the wrong type??
const getAccount: (state: any, accountId: any) => any = makeGetAccount();
/** Get the logged-in account from the store, if any */
export const useOwnAccount = (): Account | null => {
2022-10-03 06:14:45 -07:00
return useAppSelector((state) => getAccount(state, state.me));
};