make showFirstRun in localStorage a bool

This commit is contained in:
Jannis R 2016-12-12 14:15:26 +01:00
parent 1db4647327
commit 085adbaffd
No known key found for this signature in database
GPG Key ID: 0FE83946296A88A5

View File

@ -16,14 +16,17 @@
import { action, observable } from 'mobx'; import { action, observable } from 'mobx';
const showFirstRun = window.localStorage.getItem('showFirstRun') !== '0';
export default class Store { export default class Store {
@observable firstrunVisible = showFirstRun; @observable firstrunVisible = false;
constructor (api) { constructor (api) {
this._api = api; this._api = api;
const value = window.localStorage.getItem('showFirstRun');
if (value) {
this.firstrunVisible = JSON.parse(value);
}
this._checkAccounts(); this._checkAccounts();
} }
@ -33,7 +36,7 @@ export default class Store {
@action toggleFirstrun = (visible = false) => { @action toggleFirstrun = (visible = false) => {
this.firstrunVisible = visible; this.firstrunVisible = visible;
window.localStorage.setItem('showFirstRun', visible ? '1' : '0'); window.localStorage.setItem('showFirstRun', JSON.stringify(!!visible));
} }
_checkAccounts () { _checkAccounts () {