mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 23:15:57 +08:00
fix: show org onboarding only to cloud customers (#6451)
This commit is contained in:
parent
504bc0d541
commit
371224a64a
@ -22,6 +22,7 @@ import AppActions from 'types/actions';
|
|||||||
import { UPDATE_USER_IS_FETCH } from 'types/actions/app';
|
import { UPDATE_USER_IS_FETCH } from 'types/actions/app';
|
||||||
import { Organization } from 'types/api/user/getOrganization';
|
import { Organization } from 'types/api/user/getOrganization';
|
||||||
import AppReducer from 'types/reducer/app';
|
import AppReducer from 'types/reducer/app';
|
||||||
|
import { isCloudUser } from 'utils/app';
|
||||||
import { routePermission } from 'utils/permission';
|
import { routePermission } from 'utils/permission';
|
||||||
|
|
||||||
import routes, {
|
import routes, {
|
||||||
@ -76,6 +77,8 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
|
|||||||
|
|
||||||
const { t } = useTranslation(['common']);
|
const { t } = useTranslation(['common']);
|
||||||
|
|
||||||
|
const isCloudUserVal = isCloudUser();
|
||||||
|
|
||||||
const localStorageUserAuthToken = getInitialUserTokenRefreshToken();
|
const localStorageUserAuthToken = getInitialUserTokenRefreshToken();
|
||||||
|
|
||||||
const dispatch = useDispatch<Dispatch<AppActions>>();
|
const dispatch = useDispatch<Dispatch<AppActions>>();
|
||||||
@ -143,6 +146,7 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
|
|||||||
const handleRedirectForOrgOnboarding = (key: string): void => {
|
const handleRedirectForOrgOnboarding = (key: string): void => {
|
||||||
if (
|
if (
|
||||||
isLoggedInState &&
|
isLoggedInState &&
|
||||||
|
isCloudUserVal &&
|
||||||
!isFetchingOrgPreferences &&
|
!isFetchingOrgPreferences &&
|
||||||
!isLoadingOrgUsers &&
|
!isLoadingOrgUsers &&
|
||||||
!isEmpty(orgUsers?.payload) &&
|
!isEmpty(orgUsers?.payload) &&
|
||||||
@ -158,6 +162,10 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
|
|||||||
history.push(ROUTES.ONBOARDING);
|
history.push(ROUTES.ONBOARDING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isCloudUserVal && key === 'ONBOARDING') {
|
||||||
|
history.push(ROUTES.APPLICATION);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleUserLoginIfTokenPresent = async (
|
const handleUserLoginIfTokenPresent = async (
|
||||||
@ -250,7 +258,7 @@ function PrivateRoute({ children }: PrivateRouteProps): JSX.Element {
|
|||||||
const handleRouting = (): void => {
|
const handleRouting = (): void => {
|
||||||
const showOrgOnboarding = shouldShowOnboarding();
|
const showOrgOnboarding = shouldShowOnboarding();
|
||||||
|
|
||||||
if (showOrgOnboarding && !isOnboardingComplete) {
|
if (showOrgOnboarding && !isOnboardingComplete && isCloudUserVal) {
|
||||||
history.push(ROUTES.ONBOARDING);
|
history.push(ROUTES.ONBOARDING);
|
||||||
} else {
|
} else {
|
||||||
history.push(ROUTES.APPLICATION);
|
history.push(ROUTES.APPLICATION);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user