feat: fixed reset of app settings
This commit is contained in:
parent
999c47789b
commit
3c8c804fc3
@ -9,6 +9,7 @@ AppSideService(
|
|||||||
onRequest(req, res){
|
onRequest(req, res){
|
||||||
if(req.method === 'totps'){
|
if(req.method === 'totps'){
|
||||||
console.log(req)
|
console.log(req)
|
||||||
|
console.log(`sending response: ${settings.settingsStorage.getItem('TOTPs')}`)
|
||||||
res(null, settings.settingsStorage.getItem('TOTPs'))
|
res(null, settings.settingsStorage.getItem('TOTPs'))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -9,10 +9,11 @@ Page(
|
|||||||
onInit() {
|
onInit() {
|
||||||
this.getTOTPData().then((x) => {
|
this.getTOTPData().then((x) => {
|
||||||
console.log(x)
|
console.log(x)
|
||||||
app._options.globalData.TOTPS = x ?? []
|
app._options.globalData.TOTPS = JSON.parse(x) ?? []
|
||||||
this.initPage()
|
this.initPage()
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch((x) => {
|
||||||
|
console.log(x)
|
||||||
app._options.globalData.TOTPS = []
|
app._options.globalData.TOTPS = []
|
||||||
this.initPage()
|
this.initPage()
|
||||||
})
|
})
|
||||||
|
@ -6,7 +6,8 @@ AppSettingsPage({
|
|||||||
build(props) {
|
build(props) {
|
||||||
_props = props;
|
_props = props;
|
||||||
|
|
||||||
const storage = props.settingsStorage.getItem("TOTPs") ?? []
|
console.log(props.settingsStorage.getItem("TOTPs"))
|
||||||
|
const storage = JSON.parse(props.settingsStorage.getItem("TOTPs") ?? "[]")
|
||||||
const totpEntrys = GetTOTPList(storage)
|
const totpEntrys = GetTOTPList(storage)
|
||||||
const createButton = TextInput({
|
const createButton = TextInput({
|
||||||
placeholder: "otpauth://",
|
placeholder: "otpauth://",
|
||||||
@ -160,5 +161,5 @@ function GetTOTPList(storage){
|
|||||||
function updateStorage(storage){
|
function updateStorage(storage){
|
||||||
console.log("new storage is:")
|
console.log("new storage is:")
|
||||||
console.log(storage)
|
console.log(storage)
|
||||||
_props.settingsStorage.setItem('TOTPs', storage)
|
_props.settingsStorage.setItem('TOTPs', JSON.stringify(storage))
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user