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

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:48 +01:00
committed by GitHub
co-authored by Misi
parent 4428bf7025
commit 1de9f9477f
@@ -28,7 +28,10 @@ export function OrganizationSwitcher() {
}
};
useEffect(() => {
if (contextSrv.isSignedIn) {
if (
contextSrv.isSignedIn &&
!(contextSrv.user.authenticatedBy === 'apikey' || contextSrv.user.authenticatedBy === 'render')
) {
dispatch(getUserOrganizations());
}
}, [dispatch]);