Skip to content

Commit

Permalink
Fix uninitialized recordPreset userdata
Browse files Browse the repository at this point in the history
Signed-off-by: James Chien <[email protected]>
  • Loading branch information
shc261392 committed Jul 6, 2020
1 parent 1bed001 commit f480f8c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { filter, first, switchMap, take } from 'rxjs/operators';

import { Plugins, StatusBarStyle } from '@capacitor/core';
import { LanguageService } from '@core/services/language.service';
import { RecordPreset } from '@core/services/preset.service';
import { Platform } from '@ionic/angular';

import { DataStoreService } from './core/services/store/data-store.service';
Expand All @@ -30,6 +31,9 @@ export class AppComponent {
.pipe(
switchMap(() => this.language.init()),
switchMap(() => this.dataStore.userData$.pipe(take(1))),
switchMap(userData => {
return (userData.recordPreset) ? of(userData) : this.dataStore.updateUserData({ recordPreset: RecordPreset.COMMON_COLD });
})
)
.subscribe(userData => {
if (userData.newUser) {
Expand Down

0 comments on commit f480f8c

Please sign in to comment.