1
0
mirror of https://github.com/bitwarden/jslib synced 2026-01-07 11:03:13 +00:00

[bug] Adjust theme to be a global state item

This commit is contained in:
addison
2021-11-16 10:06:26 -05:00
parent 36b52d3594
commit 537df46098

View File

@@ -1096,17 +1096,10 @@ export class StateService implements StateServiceAbstraction {
}
async getTheme(options?: StorageOptions): Promise<string> {
const accountTheme = (await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())))?.theme;
const globalTheme = (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())))?.theme;
return accountTheme ?? globalTheme;
return (await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions())))?.theme;
}
async setTheme(value: string, options?: StorageOptions): Promise<void> {
const account = await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()));
if (account != null) {
account.theme = value;
await this.saveAccount(account, this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()));
}
async setTheme(value: string, options?: StorageOptions): Promise<void> {
const globals = await this.getGlobals(this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()));
globals.theme = value;
await this.saveGlobals(globals, this.reconcileOptions(options, await this.defaultOnDiskLocalOptions()));