mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-08 18:39:01 +08:00
fix: do not try to route to org onboarding when workspace locked or suspended (#6692)
This commit is contained in:
parent
2c2e248c95
commit
bef6cc945a
@ -18,6 +18,7 @@ import routes, {
|
||||
LIST_LICENSES,
|
||||
oldNewRoutesMapping,
|
||||
oldRoutes,
|
||||
ROUTES_NOT_TO_BE_OVERRIDEN,
|
||||
SUPPORT_ROUTE,
|
||||
} from './routes';
|
||||
|
||||
@ -90,7 +91,12 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
|
||||
)?.value;
|
||||
|
||||
const isFirstUser = checkFirstTimeUser();
|
||||
if (isFirstUser && !isOnboardingComplete) {
|
||||
if (
|
||||
isFirstUser &&
|
||||
!isOnboardingComplete &&
|
||||
// if the current route is allowed to be overriden by org onboarding then only do the same
|
||||
!ROUTES_NOT_TO_BE_OVERRIDEN.includes(pathname)
|
||||
) {
|
||||
history.push(ROUTES.ONBOARDING);
|
||||
}
|
||||
}
|
||||
|
@ -443,6 +443,11 @@ export const oldNewRoutesMapping: Record<string, string> = {
|
||||
'/settings/access-tokens': '/settings/api-keys',
|
||||
};
|
||||
|
||||
export const ROUTES_NOT_TO_BE_OVERRIDEN: string[] = [
|
||||
ROUTES.WORKSPACE_LOCKED,
|
||||
ROUTES.WORKSPACE_SUSPENDED,
|
||||
];
|
||||
|
||||
export interface AppRoutes {
|
||||
component: RouteProps['component'];
|
||||
path: RouteProps['path'];
|
||||
|
@ -144,7 +144,7 @@ export function AppProvider({ children }: PropsWithChildren): JSX.Element {
|
||||
error: orgPreferencesFetchError,
|
||||
} = useQuery({
|
||||
queryFn: () => getAllOrgPreferences(),
|
||||
queryKey: ['getOrgPreferences'],
|
||||
queryKey: ['getOrgPreferences', 'app-context'],
|
||||
enabled: !!isLoggedIn && !!user.email && user.role === USER_ROLES.ADMIN,
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user