fix the booking and contract
Build & Push / Pipeline Tests (push) Failing after 1m31s
Build & Push / Build & Push Docker Image (push) Has been skipped
Test / Type Check (all packages) (push) Successful in 55s
Test / API Unit Tests (push) Successful in 1m8s
Test / Homepage Unit Tests (push) Successful in 47s
Test / Carplace Unit Tests (push) Successful in 44s
Test / Admin Unit Tests (push) Successful in 43s
Test / Dashboard Unit Tests (push) Failing after 46s
Test / API Integration Tests (push) Successful in 1m7s
Build & Push / Pipeline Tests (push) Failing after 1m31s
Build & Push / Build & Push Docker Image (push) Has been skipped
Test / Type Check (all packages) (push) Successful in 55s
Test / API Unit Tests (push) Successful in 1m8s
Test / Homepage Unit Tests (push) Successful in 47s
Test / Carplace Unit Tests (push) Successful in 44s
Test / Admin Unit Tests (push) Successful in 43s
Test / Dashboard Unit Tests (push) Failing after 46s
Test / API Integration Tests (push) Successful in 1m7s
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
import { usePathname, useRouter } from 'next/navigation'
|
||||
import { useEffect, useState } from 'react'
|
||||
import { apiFetch } from '@/lib/api'
|
||||
import { toDashboardAppPath, toPublicDashboardPath } from '@/lib/dashboardPaths'
|
||||
import { buildHomepageSignInPath, toDashboardAppPath, toPublicDashboardPath } from '@/lib/dashboardPaths'
|
||||
import {
|
||||
getDashboardFallbackRoute,
|
||||
resolveDashboardRoutePolicy,
|
||||
@@ -32,6 +32,7 @@ const ROLE_RANK: Record<string, number> = { OWNER: 3, MANAGER: 2, AGENT: 1 }
|
||||
const BASELINE_MENU_ROUTES = [
|
||||
{ route: '/', minRole: 'AGENT' },
|
||||
{ route: '/reservations', minRole: 'AGENT' },
|
||||
{ route: '/contracts', minRole: 'AGENT' },
|
||||
{ route: '/fleet', minRole: 'AGENT' },
|
||||
{ route: '/customers', minRole: 'AGENT' },
|
||||
{ route: '/reports', minRole: 'MANAGER' },
|
||||
@@ -72,7 +73,11 @@ export function resolveAllowedRoutes(menu: EmployeeMenuResponse, role: string):
|
||||
menu.subscriptionAccessLevel !== 'none' &&
|
||||
featureRoutes.length === 0
|
||||
|
||||
return shouldUseBaselineFallback ? getBaselineInternalRoutes(role) : routes
|
||||
const resolvedRoutes = shouldUseBaselineFallback ? getBaselineInternalRoutes(role) : routes
|
||||
if (resolvedRoutes.includes('/reservations') && !resolvedRoutes.includes('/contracts')) {
|
||||
return [...resolvedRoutes, '/contracts']
|
||||
}
|
||||
return resolvedRoutes
|
||||
}
|
||||
|
||||
export function isAllowedRoute(currentPath: string, allowedRoutes: string[]) {
|
||||
@@ -91,9 +96,7 @@ export function resolveAccessRedirect(currentPath: string, allowedRoutes: string
|
||||
}
|
||||
|
||||
export function buildSignInRedirect(currentPath: string) {
|
||||
const params = new URLSearchParams()
|
||||
params.set('redirect', toPublicDashboardPath(currentPath))
|
||||
return `${toPublicDashboardPath('/sign-in')}?${params.toString()}`
|
||||
return buildHomepageSignInPath(currentPath)
|
||||
}
|
||||
|
||||
export default function DashboardAccessGuard({ children }: { children: React.ReactNode }) {
|
||||
|
||||
Reference in New Issue
Block a user