diff --git a/page/index.js b/page/index.js index ac87bd0..22fd8b0 100644 --- a/page/index.js +++ b/page/index.js @@ -11,8 +11,8 @@ Page( onInit() { this.getTOTPData().then((x) => { console.log(x) - localStorage.setItem('TOTPs', x) - app._options.globalData.TOTPS = x + localStorage.setItem('TOTPs', x ?? []) + app._options.globalData.TOTPS = x ?? [] this.initPage(); }) .catch(() => { diff --git a/setting/index.js b/setting/index.js index 9400ed2..5cebbe9 100644 --- a/setting/index.js +++ b/setting/index.js @@ -5,7 +5,7 @@ let _props = null; AppSettingsPage({ build(props) { _props = props; - const storage = props.settingsStorage.getItem("TOTPs") + const storage = props.settingsStorage.getItem("TOTPs") ?? [] const totpEntrys = GetTOTPList(storage) const createButton = TextInput({ placeholder: "otpauth://",