adjustments
This commit is contained in:
+10
-3
@@ -19,9 +19,16 @@ func getStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func updateStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// TODO: read request and update statuses
|
||||
// TODO: read request and update statuses
|
||||
|
||||
println("changing status")
|
||||
println("changing status")
|
||||
|
||||
queryParams := r.URL.Query()
|
||||
h_status := queryParams.Get("statush")
|
||||
a_status := queryParams.Get("statusa")
|
||||
|
||||
statusOne = h_status
|
||||
statusTwo = a_status
|
||||
|
||||
getStatusHandler(w, r)
|
||||
}
|
||||
@@ -32,8 +39,8 @@ func main() {
|
||||
component := templates.Hello("John")
|
||||
http.Handle("/hello", templ.Handler(component))
|
||||
|
||||
http.HandleFunc("/", getStatusHandler)
|
||||
http.HandleFunc("/changestatus", updateStatusHandler)
|
||||
http.HandleFunc("/", getStatusHandler)
|
||||
|
||||
fmt.Println("Listening on :3000")
|
||||
http.ListenAndServe(":3000", nil)
|
||||
|
||||
@@ -9,14 +9,15 @@ templ GetStatus(statusOne string, statusTwo string) {
|
||||
hx-swap="outerHTML"
|
||||
>
|
||||
<input
|
||||
id="statusH" name="Status H" type="text"
|
||||
id="statusH" name="statush" type="text"
|
||||
placeholder="Enter status H"
|
||||
value={ statusOne }
|
||||
/>
|
||||
|
||||
<input
|
||||
id="statusA" name="Status A" type="text"
|
||||
placeholder="Enter status, A" value={ statusTwo }
|
||||
id="statusA" name="statusa" type="text"
|
||||
placeholder="Enter status, A"
|
||||
value={ statusTwo }
|
||||
/>
|
||||
|
||||
<button type="submit" class="button is-primary">Update</button>
|
||||
|
||||
@@ -31,7 +31,7 @@ func GetStatus(statusOne string, statusTwo string) templ.Component {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("</script><div id=\"main\" class=\"flex flex-row gap-2\"><form hx-post=\"/changestatus\" hx-target=\"#main\" hx-swap=\"outerHTML\"><input id=\"statusH\" name=\"Status H\" type=\"text\" placeholder=\"Enter status H\" value=\"")
|
||||
_, err = templBuffer.WriteString("</script><div id=\"main\" class=\"flex flex-row gap-2\"><form hx-post=\"/changestatus\" hx-target=\"#main\" hx-swap=\"outerHTML\"><input id=\"statusH\" name=\"statush\" type=\"text\" placeholder=\"Enter status H\" value=\"")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -39,7 +39,7 @@ func GetStatus(statusOne string, statusTwo string) templ.Component {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = templBuffer.WriteString("\"><input id=\"statusA\" name=\"Status A\" type=\"text\" placeholder=\"Enter status, A\" value=\"")
|
||||
_, err = templBuffer.WriteString("\"><input id=\"statusA\" name=\"statusa\" type=\"text\" placeholder=\"Enter status, A\" value=\"")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user