23 lines
385 B
Go
23 lines
385 B
Go
package router
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"go.jolheiser.com/gistea/static"
|
|
)
|
|
|
|
func (a *App) newGist(w http.ResponseWriter, r *http.Request) {
|
|
page := static.New
|
|
|
|
repos, err := a.store.Repos(r)
|
|
if err != nil {
|
|
page = static.Landing
|
|
}
|
|
|
|
if err := a.Tmpl(w, r, page, map[string]any{
|
|
"Repos": repos,
|
|
}); err != nil {
|
|
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
}
|
|
}
|