diff --git a/public/app/core/services/toggleTheme.ts b/public/app/core/services/toggleTheme.ts index 307dfea48db..0836b3cd1a8 100644 --- a/public/app/core/services/toggleTheme.ts +++ b/public/app/core/services/toggleTheme.ts @@ -3,6 +3,7 @@ import { ThemeChangedEvent } from 'app/types/events'; import appEvents from '../app_events'; import { config } from '../config'; import { PreferencesService } from './PreferencesService'; +import { contextSrv } from '../core'; export async function toggleTheme(runtimeOnly: boolean) { const currentTheme = config.theme; @@ -32,6 +33,10 @@ export async function toggleTheme(runtimeOnly: boolean) { } } + if (!contextSrv.isSignedIn) { + return; + } + // Persist new theme const service = new PreferencesService('user'); const currentPref = await service.load();