[v11.1.x] Fix: Do not fetch Orgs if the user is authenticated by apikey/sa or render key (#97261)

Fix: Do not fetch Orgs if the user is authenticated by apikey/sa or render key (#97162)

* Do not fetch Orgs if the user is authenticated by apikey/sa or render svc

* Lint

(cherry picked from commit fa634e1476)

Co-authored-by: Misi <mgyongyosi@users.noreply.github.com>
This commit is contained in:
grafana-delivery-bot[bot]
2024-12-02 16:06:29 +01:00
committed by GitHub
co-authored by Misi
parent 525acc68dc
commit 4675cd82a0
@@ -24,7 +24,10 @@ export function OrganizationSwitcher() {
}
};
useEffect(() => {
if (contextSrv.isSignedIn) {
if (
contextSrv.isSignedIn &&
!(contextSrv.user.authenticatedBy === 'apikey' || contextSrv.user.authenticatedBy === 'render')
) {
dispatch(getUserOrganizations());
}
}, [dispatch]);