provide confdata as type

This commit is contained in:
Helmut Merz 2023-02-27 09:19:29 +01:00
parent 1ad9e70c00
commit 5f793c354e

View file

@ -1,16 +1,16 @@
import { api, polling } from './settings' import { api, polling } from './settings'
const confdata = { type confdata = {
pollurl: '' pollurl: string
} }
export function config (api, polling) { export function config (api, polling): confdata {
return undefined return { pollurl: '' }
} }
export const pvapp = { export const pvapp = {
$delimiters: ['{|', '|}'], $delimiters: ['{|', '|}'],
conf: confdata, conf: {} as confdata,
data: {}, data: {},
output: '', output: '',
save, save,
@ -28,9 +28,10 @@ async function dopoll(app: typeof pvapp) {
while (true) { while (true) {
try { try {
let res = await fetch(pvapp.conf.pollurl) let res = await fetch(pvapp.conf.pollurl)
let data = await res.json() let msg = await res.json()
console.log(data) console.log(msg)
//obj.newdata = data['status'] //app.handle(msg)
//app.newdata = data['status']
} catch (error) { } catch (error) {
console.log(error) console.log(error)
await new Promise(r => setTimeout(r, 10000)) await new Promise(r => setTimeout(r, 10000))