fix: use format string for datastar.PostSSE in chat component
PostSSE requires a constant format string; pass "%s" with the URL as an argument instead of passing the URL directly.
This commit is contained in:
@@ -43,20 +43,20 @@ templ Chat(messages []chat.Message, cfg Config) {
|
|||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
data-bind="chatMsg"
|
data-bind="chatMsg"
|
||||||
data-on:keydown.stop=""
|
data-on:keydown.stop=""
|
||||||
data-on:keydown.key_enter={ datastar.PostSSE(cfg.PostURL) }
|
data-on:keydown.key_enter={ datastar.PostSSE("%s", cfg.PostURL) }
|
||||||
/>
|
/>
|
||||||
} else {
|
} else {
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
placeholder="Chat..."
|
placeholder="Chat..."
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
data-bind="chatMsg"
|
data-bind="chatMsg"
|
||||||
data-on:keydown.enter={ datastar.PostSSE(cfg.PostURL) }
|
data-on:keydown.enter={ datastar.PostSSE("%s", cfg.PostURL) }
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
data-on:click={ datastar.PostSSE(cfg.PostURL) }
|
data-on:click={ datastar.PostSSE("%s", cfg.PostURL) }
|
||||||
>
|
>
|
||||||
Send
|
Send
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user