Redirect all /auth routes
This commit is contained in:
parent
55c4e3a00b
commit
5731b9b1c7
14 changed files with 31 additions and 3 deletions
Binary file not shown.
Binary file not shown.
|
@ -285,7 +285,7 @@ const SidebarMenu: React.FC = (): JSX.Element | null => {
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
<SidebarLink
|
<SidebarLink
|
||||||
to='/auth/sign_out'
|
to='/logout'
|
||||||
icon={require('@tabler/icons/icons/logout.svg')}
|
icon={require('@tabler/icons/icons/logout.svg')}
|
||||||
text={intl.formatMessage(messages.logout)}
|
text={intl.formatMessage(messages.logout)}
|
||||||
onClick={onClickLogOut}
|
onClick={onClickLogOut}
|
||||||
|
|
Binary file not shown.
Binary file not shown.
28
app/soapbox/features/auth_login/components/logout.tsx
Normal file
28
app/soapbox/features/auth_login/components/logout.tsx
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
import React, { useEffect, useState } from 'react';
|
||||||
|
import { useIntl } from 'react-intl';
|
||||||
|
import { useDispatch } from 'react-redux';
|
||||||
|
import { Redirect } from 'react-router-dom';
|
||||||
|
|
||||||
|
import { logOut } from 'soapbox/actions/auth';
|
||||||
|
import { Spinner } from 'soapbox/components/ui';
|
||||||
|
|
||||||
|
/** Component that logs the user out when rendered */
|
||||||
|
const Logout: React.FC = () => {
|
||||||
|
const intl = useIntl();
|
||||||
|
const dispatch = useDispatch();
|
||||||
|
const [done, setDone] = useState(false);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
(dispatch(logOut(intl)) as any)
|
||||||
|
.then(() => setDone(true))
|
||||||
|
.catch(console.warn);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (done) {
|
||||||
|
return <Redirect to='/' />;
|
||||||
|
} else {
|
||||||
|
return <Spinner />;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Logout;
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -59,7 +59,7 @@ const LinkFooter: React.FC = (): JSX.Element => {
|
||||||
{(features.federating && features.accountMoving) && (
|
{(features.federating && features.accountMoving) && (
|
||||||
<FooterLink to='/settings/migration'><FormattedMessage id='navigation_bar.account_migration' defaultMessage='Move account' /></FooterLink>
|
<FooterLink to='/settings/migration'><FormattedMessage id='navigation_bar.account_migration' defaultMessage='Move account' /></FooterLink>
|
||||||
)}
|
)}
|
||||||
<FooterLink to='/auth/sign_out' onClick={onClickLogOut}><FormattedMessage id='navigation_bar.logout' defaultMessage='Logout' /></FooterLink>
|
<FooterLink to='/logout' onClick={onClickLogOut}><FormattedMessage id='navigation_bar.logout' defaultMessage='Logout' /></FooterLink>
|
||||||
</>}
|
</>}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ const ProfileDropdown: React.FC<IProfileDropdown> = ({ account, children }) => {
|
||||||
|
|
||||||
menu.push({
|
menu.push({
|
||||||
text: intl.formatMessage(messages.logout, { acct: account.acct }),
|
text: intl.formatMessage(messages.logout, { acct: account.acct }),
|
||||||
to: '/auth/sign_out',
|
to: '/logout',
|
||||||
action: handleLogOut,
|
action: handleLogOut,
|
||||||
icon: require('@tabler/icons/icons/logout.svg'),
|
icon: require('@tabler/icons/icons/logout.svg'),
|
||||||
});
|
});
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in a new issue