Clean up me
usage
This commit is contained in:
parent
fdb44d615d
commit
e88fe4a707
5 changed files with 9 additions and 12 deletions
|
@ -83,7 +83,7 @@ export default (getState: () => RootState, authType: string = 'user'): AxiosInst
|
|||
const state = getState();
|
||||
const accessToken = getToken(state, authType);
|
||||
const me = state.me;
|
||||
const baseURL = getAuthBaseURL(state, me);
|
||||
const baseURL = me ? getAuthBaseURL(state, me) : '';
|
||||
|
||||
return baseClient(accessToken, baseURL);
|
||||
};
|
||||
|
|
|
@ -66,7 +66,7 @@ const messages = defineMessages({
|
|||
|
||||
const mapStateToProps = (state: RootState) => {
|
||||
const me = state.me;
|
||||
const account = state.accounts.get(me as any);
|
||||
const account = state.accounts.get(me);
|
||||
const instance = state.instance;
|
||||
|
||||
return {
|
||||
|
|
|
@ -7,7 +7,7 @@ import { Link } from 'react-router-dom';
|
|||
import { logOut, switchAccount } from 'soapbox/actions/auth';
|
||||
import { fetchOwnAccounts } from 'soapbox/actions/auth';
|
||||
import { Menu, MenuButton, MenuDivider, MenuItem, MenuLink, MenuList } from 'soapbox/components/ui';
|
||||
import { useAppSelector } from 'soapbox/hooks';
|
||||
import { useAppSelector, useOwnAccount } from 'soapbox/hooks';
|
||||
import { makeGetAccount } from 'soapbox/selectors';
|
||||
|
||||
import Account from '../../../components/account';
|
||||
|
@ -36,8 +36,7 @@ const ProfileDropdown: React.FC<IProfileDropdown> = ({ account, children }) => {
|
|||
const dispatch = useDispatch();
|
||||
const intl = useIntl();
|
||||
|
||||
const me = useAppSelector((state) => state.me);
|
||||
const currentAccount = useAppSelector((state) => getAccount(state, me));
|
||||
const currentAccount = useOwnAccount();
|
||||
const authUsers = useAppSelector((state) => state.auth.get('users'));
|
||||
const isCurrentAccountStaff = Boolean(currentAccount?.staff);
|
||||
const otherAccounts = useAppSelector((state) => authUsers.map((authUser: any) => getAccount(state, authUser.get('id'))));
|
||||
|
|
|
@ -1,15 +1,13 @@
|
|||
import React from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
||||
import { Button, Stack, Text } from 'soapbox/components/ui';
|
||||
import { useAppSelector } from 'soapbox/hooks';
|
||||
import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks';
|
||||
|
||||
const SignUpPanel = () => {
|
||||
const soapboxConfig = useAppSelector((state) => getSoapboxConfig(state));
|
||||
const siteTitle: string = useAppSelector((state) => state.instance.title);
|
||||
const me: boolean | null = useAppSelector((state) => state.me);
|
||||
const singleUserMode: boolean = soapboxConfig.get('singleUserMode');
|
||||
const { singleUserMode } = useSoapboxConfig();
|
||||
const siteTitle = useAppSelector((state) => state.instance.title);
|
||||
const me = useAppSelector((state) => state.me);
|
||||
|
||||
if (me || singleUserMode) return null;
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ export interface ReducerAccount extends AccountRecord {
|
|||
moved: string | null,
|
||||
}
|
||||
|
||||
type State = ImmutableMap<string | number, ReducerAccount>;
|
||||
type State = ImmutableMap<any, ReducerAccount>;
|
||||
|
||||
const initialState: State = ImmutableMap();
|
||||
|
||||
|
|
Loading…
Reference in a new issue