provide setSid(); + minor clean-up input shortcode

This commit is contained in:
Helmut Merz 2023-03-02 13:35:58 +01:00
parent 94da069210
commit c76426e13f
2 changed files with 13 additions and 5 deletions

View file

@ -69,7 +69,16 @@ function createSid(): string {
return arr[0].toString(36) + arr[1].toString(36)
}
console.log("sid: ", createSid())
function getSid(): string {
sid = localStorage.getItem('api.sessionid')
if (!sid) {
sid = createSid()
localStorage.setItem('api.sessionid', sid)
}
return sid
}
console.log("sid: ", getSid())
async function dopoll(app: typeof appdata) {
while (true) {

View file

@ -1,11 +1,10 @@
{{- $type := .Get "type" | default "text" -}}
{{- $name := .Get "name" | default "textline" -}}
{{- $default := .Get "default" | default "" -}}
{{- $attrs := .Get "attrs" | default "" -}}
{{- $onchange := .Get "onchange" | default "" -}}
<div>
<input type="{{ $type }}" name="{{ $name }}" {{ $attrs }}
<input type="{{ $type }}" name="{{ $name }}"
{{- with .Get "attrs" }} {{ . }}{{ end }}
v-model="data.{{ $name }}"
@vue:mounted="data.{{ $name }} = '{{ $default }}'"
@change="{{ $onchange }}" />
{{- with .Get "onchange" }} @change="{{ . }}"{{ end }} />
</div>