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"
|
||||
data-bind="chatMsg"
|
||||
data-on:keydown.stop=""
|
||||
data-on:keydown.key_enter={ datastar.PostSSE(cfg.PostURL) }
|
||||
/>
|
||||
} else {
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Chat..."
|
||||
autocomplete="off"
|
||||
data-bind="chatMsg"
|
||||
data-on:keydown.enter={ datastar.PostSSE(cfg.PostURL) }
|
||||
/>
|
||||
}
|
||||
<button
|
||||
type="button"
|
||||
data-on:click={ datastar.PostSSE(cfg.PostURL) }
|
||||
data-on:keydown.key_enter={ datastar.PostSSE("%s", cfg.PostURL) }
|
||||
/>
|
||||
} else {
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Chat..."
|
||||
autocomplete="off"
|
||||
data-bind="chatMsg"
|
||||
data-on:keydown.enter={ datastar.PostSSE("%s", cfg.PostURL) }
|
||||
/>
|
||||
}
|
||||
<button
|
||||
type="button"
|
||||
data-on:click={ datastar.PostSSE("%s", cfg.PostURL) }
|
||||
>
|
||||
Send
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user