1
0
mirror of https://github.com/bitwarden/jslib synced 2025-12-29 06:33:15 +00:00

[bug] Correct getGlobals not pulling from the stored state item

This commit is contained in:
addison
2021-11-16 10:11:06 -05:00
parent 71e0bf9857
commit 649cfe517e

View File

@@ -1176,13 +1176,10 @@ export class StateService implements StateServiceAbstraction {
return globals ?? new GlobalState();
}
private async saveGlobals(globals: GlobalState, options: StorageOptions = {
storageLocation: StorageLocation.Memory,
useSecureStorage: false,
}) {
private async saveGlobals(globals: GlobalState, options: StorageOptions) {
return this.useMemory(options.storageLocation) ?
this.saveGlobalsToMemory(globals) :
this.saveGlobalsToDisk(globals, options);
await this.saveGlobalsToDisk(globals, options);
}
private getGlobalsFromMemory(): GlobalState {
@@ -1190,7 +1187,7 @@ export class StateService implements StateServiceAbstraction {
}
private async getGlobalsFromDisk(options: StorageOptions): Promise<GlobalState> {
return await this.storageService.get<GlobalState>('globals', options);
return (await this.storageService.get<State>('state', options))?.globals;
}
private saveGlobalsToMemory(globals: GlobalState): void {