Skip to content

Commit

Permalink
fix: change it to a single field
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
  • Loading branch information
caarlos0 committed Jul 31, 2021
1 parent 86ef501 commit 0a30098
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 1 addition & 4 deletions controller/index.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package controller

import (
"fmt"
"html/template"
"io/fs"
"net/http"
Expand All @@ -14,13 +13,11 @@ func Index(fsys fs.FS) http.HandlerFunc {
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}

}
}

func HandleForm(fsys fs.FS) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
url := fmt.Sprintf("/%s/%s", r.FormValue("username"), r.FormValue("repository"))
http.Redirect(w, r, url, http.StatusSeeOther)
http.Redirect(w, r, "/"+r.FormValue("repository"), http.StatusSeeOther)
}
}
6 changes: 2 additions & 4 deletions static/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,8 @@
{{ else }}
<div class="main">
<form method="POST">
<label for="username">Username</label><br>
<input type="text" id="username" name="username"><br><br>
<label for="repo">Repository</label><br>
<input type="text" id="repository" name="repository"><br><br>
<label for="repo">Repository:</label><br>
<input type="text" id="repository" name="repository" placeholder="caarlos0/starcharts"><br><br>
<input type="submit" value="Submit">
</form>
</div>
Expand Down

0 comments on commit 0a30098

Please sign in to comment.