refactor so var doesn't conflict with import
This commit is contained in:
parent
7a1459f876
commit
8692d3ce79
12
ws.go
12
ws.go
|
@ -36,8 +36,8 @@ func newHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
} else if action != "delete" {
|
} else if action != "delete" {
|
||||||
url := bmStrict.Sanitize(params.Get("url"))
|
submittedURL := bmStrict.Sanitize(params.Get("submittedURL"))
|
||||||
if url == "" {
|
if submittedURL == "" {
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
_, err := w.Write([]byte("No URL provided"))
|
_, err := w.Write([]byte("No URL provided"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -67,7 +67,7 @@ func newHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
proj := project{
|
proj := project{
|
||||||
URL: url,
|
URL: submittedURL,
|
||||||
Name: name,
|
Name: name,
|
||||||
Forge: forge,
|
Forge: forge,
|
||||||
}
|
}
|
||||||
|
@ -85,8 +85,8 @@ func newHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
} else if action == "delete" {
|
} else if action == "delete" {
|
||||||
url := params.Get("url")
|
submittedURL := params.Get("submittedURL")
|
||||||
if url == "" {
|
if submittedURL == "" {
|
||||||
w.WriteHeader(http.StatusBadRequest)
|
w.WriteHeader(http.StatusBadRequest)
|
||||||
_, err := w.Write([]byte("No URL provided"))
|
_, err := w.Write([]byte("No URL provided"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -95,7 +95,7 @@ func newHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
untrack(url)
|
untrack(submittedURL)
|
||||||
http.Redirect(w, r, "/", http.StatusSeeOther)
|
http.Redirect(w, r, "/", http.StatusSeeOther)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue