Skip to content

Commit

Permalink
Merge pull request #952 from equinor/fix/active-impersonate-in-prod
Browse files Browse the repository at this point in the history
🩹 Don't run active impersonate user call if we're in prod
  • Loading branch information
mariush2 authored Jan 23, 2025
2 parents da664ad + c5449f7 commit d8c8d5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/organisms/TopBar/Account/Account.jsdom.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { EnvironmentType } from '@equinor/subsurface-app-management';

import { Account } from 'src/organisms/TopBar/Account/Account';
import { MOCK_USER } from 'src/providers/AuthProvider/AuthProvider';
import {
Expand Down Expand Up @@ -57,6 +59,7 @@ describe('Active impersonation', () => {
{ once: true }
)
);
vi.stubEnv('VITE_ENVIRONMENT_NAME', EnvironmentType.DEVELOP);
});

test('Active impersonation is set as selected', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
import { useQuery } from '@tanstack/react-query';

import { ACTIVE_USERIMPERSONATION } from '../Impersonate.constants';
import { environment } from 'src/atoms/utils/auth_environment';

export function useActiveImpersonationUser() {
return useQuery({
Expand All @@ -25,5 +26,8 @@ export function useActiveImpersonationUser() {
}
}
},
enabled:
environment.getEnvironmentName(import.meta.env.VITE_ENVIRONMENT_NAME) !==
'production',
});
}

0 comments on commit d8c8d5a

Please sign in to comment.