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