chore: prettier cleanup
This commit is contained in:
@@ -1,43 +1,42 @@
|
||||
import { RenderAddButton } from './render/totpRenderer'
|
||||
import { initLoop } from './render/index/renderer'
|
||||
import { BasePage } from '@zeppos/zml/base-page'
|
||||
import { RenderAddButton } from "./render/totpRenderer";
|
||||
import { initLoop } from "./render/index/renderer";
|
||||
import { BasePage } from "@zeppos/zml/base-page";
|
||||
|
||||
const app = getApp()
|
||||
const app = getApp();
|
||||
let waitForFetch = true;
|
||||
Page(
|
||||
BasePage({
|
||||
onInit() {
|
||||
this.getTOTPData().then((x) => {
|
||||
app._options.globalData.TOTPS = JSON.parse(x) ?? []
|
||||
this.initPage()
|
||||
})
|
||||
.catch((x) => {
|
||||
app._options.globalData.TOTPS = []
|
||||
this.initPage()
|
||||
})
|
||||
},
|
||||
build() {
|
||||
let fetch = setInterval(() => {
|
||||
if(waitForFetch)
|
||||
return;
|
||||
BasePage({
|
||||
onInit() {
|
||||
this.getTOTPData()
|
||||
.then((x) => {
|
||||
app._options.globalData.TOTPS = JSON.parse(x) ?? [];
|
||||
this.initPage();
|
||||
})
|
||||
.catch((x) => {
|
||||
app._options.globalData.TOTPS = [];
|
||||
this.initPage();
|
||||
});
|
||||
},
|
||||
build() {
|
||||
let fetch = setInterval(() => {
|
||||
if (waitForFetch) return;
|
||||
|
||||
clearInterval(fetch);
|
||||
const buffer = app._options.globalData.TOTPS
|
||||
if (buffer.length < 1){
|
||||
RenderAddButton('page/tip')
|
||||
}
|
||||
else {
|
||||
initLoop(buffer)
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
initPage() {
|
||||
waitForFetch = false;
|
||||
},
|
||||
getTOTPData() {
|
||||
return this.request({
|
||||
method: 'totps'
|
||||
})
|
||||
}
|
||||
})
|
||||
)
|
||||
clearInterval(fetch);
|
||||
const buffer = app._options.globalData.TOTPS;
|
||||
if (buffer.length < 1) {
|
||||
RenderAddButton("page/tip");
|
||||
} else {
|
||||
initLoop(buffer);
|
||||
}
|
||||
}, 100);
|
||||
},
|
||||
initPage() {
|
||||
waitForFetch = false;
|
||||
},
|
||||
getTOTPData() {
|
||||
return this.request({
|
||||
method: "totps",
|
||||
});
|
||||
},
|
||||
})
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user