fix: fixed application crash when count is zero

This commit is contained in:
Pavel-Savely Savianok 2024-12-30 01:27:04 +03:00
parent 14cc456d0e
commit 3c5dc5276d
2 changed files with 3 additions and 3 deletions

View File

@ -11,8 +11,8 @@ Page(
onInit() { onInit() {
this.getTOTPData().then((x) => { this.getTOTPData().then((x) => {
console.log(x) console.log(x)
localStorage.setItem('TOTPs', x) localStorage.setItem('TOTPs', x ?? [])
app._options.globalData.TOTPS = x app._options.globalData.TOTPS = x ?? []
this.initPage(); this.initPage();
}) })
.catch(() => { .catch(() => {

View File

@ -5,7 +5,7 @@ let _props = null;
AppSettingsPage({ AppSettingsPage({
build(props) { build(props) {
_props = props; _props = props;
const storage = props.settingsStorage.getItem("TOTPs") const storage = props.settingsStorage.getItem("TOTPs") ?? []
const totpEntrys = GetTOTPList(storage) const totpEntrys = GetTOTPList(storage)
const createButton = TextInput({ const createButton = TextInput({
placeholder: "otpauth://", placeholder: "otpauth://",