mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: login and signup orgslug missing bug
This commit is contained in:
parent
2e618d9c5a
commit
f4794ebaf2
5 changed files with 15 additions and 14 deletions
|
|
@ -4,6 +4,8 @@ import { useLHSession } from '@components/Contexts/LHSessionContext';
|
|||
import useAdminStatus from '@components/Hooks/useAdminStatus';
|
||||
import { usePathname, useRouter } from 'next/navigation';
|
||||
import PageLoading from '@components/Objects/Loaders/PageLoading';
|
||||
import { getUriWithoutOrg } from '@services/config/config';
|
||||
import { useOrg } from '@components/Contexts/OrgContext';
|
||||
|
||||
type AuthorizationProps = {
|
||||
children: React.ReactNode;
|
||||
|
|
@ -22,6 +24,7 @@ const ADMIN_PATHS = [
|
|||
|
||||
const AdminAuthorization: React.FC<AuthorizationProps> = ({ children, authorizationMode }) => {
|
||||
const session = useLHSession() as any;
|
||||
const org = useOrg() as any;
|
||||
const pathname = usePathname();
|
||||
const router = useRouter();
|
||||
const { isAdmin, loading } = useAdminStatus() as any
|
||||
|
|
@ -51,7 +54,7 @@ const AdminAuthorization: React.FC<AuthorizationProps> = ({ children, authorizat
|
|||
}
|
||||
|
||||
if (!isUserAuthenticated) {
|
||||
router.push('/login');
|
||||
router.push(getUriWithoutOrg('/login?orgslug=' + org.slug));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue