use json files to store data/ get css to work
This commit is contained in:
@@ -8,8 +8,8 @@ import (
|
||||
)
|
||||
|
||||
type ApiHandler struct {
|
||||
Templates *template.Template
|
||||
ProjectStore *store.SQLiteProjectStore
|
||||
Templates *template.Template
|
||||
ProjectStore *store.SQLiteProjectStore
|
||||
ExperienceStore *store.SQLiteExperienceStore
|
||||
}
|
||||
|
||||
@@ -19,14 +19,14 @@ func (h *ApiHandler) Render(w http.ResponseWriter, tmpl string, data interface{}
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func NewApiHandler(db *sql.DB) *ApiHandler {
|
||||
tmpl := template.Must(template.New("").ParseGlob("views/*.html"))
|
||||
template.Must(tmpl.ParseGlob("views/partials/*.html"))
|
||||
|
||||
return &ApiHandler{
|
||||
Templates: tmpl,
|
||||
ProjectStore: store.NewSQLiteProjectStore(db),
|
||||
Templates: tmpl,
|
||||
ProjectStore: store.NewSQLiteProjectStore(db),
|
||||
ExperienceStore: store.NewSQLiteExperienceStore(db),
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,8 @@ func (h *ApiHandler) ProjectsPage(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func (h *ApiHandler) ExperiencePage(w http.ResponseWriter, r *http.Request) {
|
||||
var hxRequest = r.Header.Get("HX-Request")
|
||||
experiences, err := h.ExperienceStore.GetAllExperiences()
|
||||
// experiences, err := h.ExperienceStore.GetAllExperiences()
|
||||
experiences, err := store.GetAllExperiencesJSON()
|
||||
if err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user