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