@ -37,6 +37,7 @@ import RemoteInstanceLayout from '@/layouts/remote-instance-layout';
|
||||
import SearchLayout from '@/layouts/search-layout';
|
||||
import StatusLayout from '@/layouts/status-layout';
|
||||
import { instanceInitialState } from '@/reducers/instance';
|
||||
import { LOCAL_STORAGE_REDIRECT_KEY } from '@/utils/redirect';
|
||||
import { isStandalone } from '@/utils/state';
|
||||
|
||||
import ChatsPageChat from '../../chats/components/chats-page/components/chats-page-chat';
|
||||
@ -174,7 +175,7 @@ const requireAuth = ({
|
||||
context: RouterContext;
|
||||
location: ParsedLocation;
|
||||
}) => {
|
||||
localStorage.setItem('plfe:redirect_uri', location.href);
|
||||
localStorage.setItem(LOCAL_STORAGE_REDIRECT_KEY, location.href);
|
||||
if (!isLoggedIn)
|
||||
throw redirect({
|
||||
to: '/login',
|
||||
|
||||
@ -22,6 +22,7 @@ import { useAcct } from '@/hooks/use-acct';
|
||||
import { useAppSelector } from '@/hooks/use-app-selector';
|
||||
import { useFeatures } from '@/hooks/use-features';
|
||||
import { useAccountLookup } from '@/queries/accounts/use-account-lookup';
|
||||
import { LOCAL_STORAGE_REDIRECT_KEY } from '@/utils/redirect';
|
||||
|
||||
/** Layout to display a user's profile. */
|
||||
const ProfileLayout: React.FC = () => {
|
||||
@ -35,7 +36,7 @@ const ProfileLayout: React.FC = () => {
|
||||
const acct = useAcct(account);
|
||||
|
||||
if (isUnauthorized) {
|
||||
localStorage.setItem('plfe:redirect_uri', location.href);
|
||||
localStorage.setItem(LOCAL_STORAGE_REDIRECT_KEY, location.href);
|
||||
return <Navigate to='/login' />;
|
||||
}
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
const LOCAL_STORAGE_REDIRECT_KEY = 'plfe:redirect_uri';
|
||||
const LOCAL_STORAGE_REDIRECT_KEY = 'nicolium:redirect_uri';
|
||||
|
||||
const getRedirectUrl = () => {
|
||||
let redirectUri = localStorage.getItem(LOCAL_STORAGE_REDIRECT_KEY);
|
||||
@ -10,4 +10,4 @@ const getRedirectUrl = () => {
|
||||
return redirectUri ?? '/';
|
||||
};
|
||||
|
||||
export { getRedirectUrl };
|
||||
export { getRedirectUrl, LOCAL_STORAGE_REDIRECT_KEY };
|
||||
|
||||
Reference in New Issue
Block a user