Skip to content

Commit

Permalink
Do not create bin when opening the front page
Browse files Browse the repository at this point in the history
  • Loading branch information
espebra committed Sep 18, 2020
1 parent 00a3502 commit f4b0da4
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions http_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,7 @@ func (h *HTTP) Index(w http.ResponseWriter, r *http.Request) {

bin := &ds.Bin{}
bin.ExpiredAt = time.Now().UTC().Add(h.expirationDuration)
err := h.dao.Bin().Insert(bin)
if err != nil {
fmt.Printf("Unable to insert new bin: %s\n", err.Error())
http.Error(w, "Errno 301", http.StatusInternalServerError)
return
}
bin.Id = h.dao.Bin().GenerateId()
data.Bin = *bin

if err := h.templates.ExecuteTemplate(w, "index", data); err != nil {
Expand Down

0 comments on commit f4b0da4

Please sign in to comment.