2024-08-18 04:29:25 +00:00
|
|
|
package pages
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"github.com/Cameron-Reed1/todo-web/pages/templates"
|
|
|
|
)
|
|
|
|
|
|
|
|
func RootPage(w http.ResponseWriter, r *http.Request) {
|
2024-09-23 18:50:21 +00:00
|
|
|
username, err := validateSessionAndGetUsername(r)
|
|
|
|
if err != nil {
|
|
|
|
w.Header().Add("Location", "/login")
|
|
|
|
w.WriteHeader(http.StatusFound)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
templates.RootPage(username).Render(r.Context(), w)
|
2024-08-18 04:29:25 +00:00
|
|
|
}
|