fix: fechaPagoP pipe timestamp, admin redirects, despacho plans, CSF parsing
This commit is contained in:
@@ -7,7 +7,7 @@ import Image from 'next/image';
|
||||
import { Button, Input, Label, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@horux/shared-ui';
|
||||
import { login } from '@/lib/api/auth';
|
||||
import { useAuthStore } from '@/stores/auth-store';
|
||||
import { isGlobalAdminRfc, type PlatformRole } from '@horux/shared';
|
||||
|
||||
|
||||
export default function LoginPage() {
|
||||
const router = useRouter();
|
||||
@@ -30,13 +30,7 @@ export default function LoginPage() {
|
||||
setUser(response.user);
|
||||
|
||||
const userRole = response.user?.role;
|
||||
// Admin global aterriza directo en `/clientes` — su home natural es la
|
||||
// gestión de tenants, no el dashboard operativo del despacho.
|
||||
const platformRoles = (response.user as { platformRoles?: PlatformRole[] }).platformRoles;
|
||||
const isGlobalAdmin = isGlobalAdminRfc(response.user?.tenantRfc, userRole, platformRoles);
|
||||
if (isGlobalAdmin) {
|
||||
router.push('/clientes');
|
||||
} else if (userRole === 'cliente' || userRole === 'auxiliar' || userRole === 'supervisor') {
|
||||
if (userRole === 'cliente' || userRole === 'auxiliar' || userRole === 'supervisor') {
|
||||
// Clients and roles without onboarding go straight to dashboard
|
||||
router.push('/dashboard');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user