WIP: fix most broken stuff for now
+ still need to figure out why some routes aren't working
This commit is contained in:
parent
114b7b1387
commit
66d92df040
@ -8,7 +8,7 @@ import (
|
|||||||
"git.markbailey.dev/cerbervs/ptpp/lib/logger"
|
"git.markbailey.dev/cerbervs/ptpp/lib/logger"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/lib/middleware"
|
"git.markbailey.dev/cerbervs/ptpp/lib/middleware"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/lib/session"
|
"git.markbailey.dev/cerbervs/ptpp/lib/session"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/util/shared"
|
"git.markbailey.dev/cerbervs/ptpp/util"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
@ -77,8 +77,8 @@ func (r Router) RegisterFs() {
|
|||||||
r.Mux = http.NewServeMux()
|
r.Mux = http.NewServeMux()
|
||||||
}
|
}
|
||||||
|
|
||||||
fs := http.FileServer(http.Dir(shared.GetFullyQualifiedPath("/public")))
|
fs := http.FileServer(http.Dir(util.GetFullyQualifiedPath("/public")))
|
||||||
log.Println("Serving static files from: " + shared.GetFullyQualifiedPath("/public"))
|
log.Println("Serving static files from: " + util.GetFullyQualifiedPath("/public"))
|
||||||
r.Mux.Handle("GET "+r.BasePath+"public/", http.StripPrefix("/public/", fs))
|
r.Mux.Handle("GET "+r.BasePath+"public/", http.StripPrefix("/public/", fs))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ type RouteMapping struct {
|
|||||||
Name string
|
Name string
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetFlatRouteList(r Router) []RouteMapping {
|
func (r Router) GetFlatRouteList() []RouteMapping {
|
||||||
var routes []RouteMapping
|
var routes []RouteMapping
|
||||||
|
|
||||||
for _, route := range r.Routes {
|
for _, route := range r.Routes {
|
||||||
@ -95,15 +95,14 @@ func GetFlatRouteList(r Router) []RouteMapping {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, subRouter := range *r.SubRouters {
|
for _, subRouter := range *r.SubRouters {
|
||||||
routes = append(routes, GetFlatRouteList(subRouter)...)
|
routes = append(routes, subRouter.GetFlatRouteList()...)
|
||||||
}
|
}
|
||||||
|
|
||||||
return routes
|
return routes
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetRouteByName(name string) (string, error) {
|
func (r Router) GetRouteByName(name string) (string, error) {
|
||||||
r := AppRouter
|
for _, route := range r.GetFlatRouteList() {
|
||||||
for _, route := range GetFlatRouteList(r) {
|
|
||||||
if route.Name == name {
|
if route.Name == name {
|
||||||
return route.Path, nil
|
return route.Path, nil
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"git.markbailey.dev/cerbervs/ptpp/app"
|
"git.markbailey.dev/cerbervs/ptpp/app"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/app/routing"
|
"git.markbailey.dev/cerbervs/ptpp/app/routing"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/app/server"
|
main2 "git.markbailey.dev/cerbervs/ptpp/app/server"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -31,7 +31,7 @@ func main() {
|
|||||||
port = devPort
|
port = devPort
|
||||||
}
|
}
|
||||||
|
|
||||||
s := server.Server{
|
s := main2.Server{
|
||||||
Addr: addr,
|
Addr: addr,
|
||||||
Server: http.Server{
|
Server: http.Server{
|
||||||
Addr: addr + ":" + strconv.Itoa(port),
|
Addr: addr + ":" + strconv.Itoa(port),
|
||||||
|
@ -8,8 +8,7 @@ import (
|
|||||||
"git.markbailey.dev/cerbervs/ptpp/lib/database/dto"
|
"git.markbailey.dev/cerbervs/ptpp/lib/database/dto"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/lib/logger"
|
"git.markbailey.dev/cerbervs/ptpp/lib/logger"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/lib/session"
|
"git.markbailey.dev/cerbervs/ptpp/lib/session"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/util/auth"
|
"git.markbailey.dev/cerbervs/ptpp/util"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/util/shared"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -67,10 +66,10 @@ func (c SignOutHandler) Init(s session.IManager, d database.IDB, l logger.ILogge
|
|||||||
func (c PopulateHandler) Get(w http.ResponseWriter, r *http.Request) error {
|
func (c PopulateHandler) Get(w http.ResponseWriter, r *http.Request) error {
|
||||||
existingOrg, err := c.Db.Repo().FindOrganizationByName("CerbervsSoft")
|
existingOrg, err := c.Db.Repo().FindOrganizationByName("CerbervsSoft")
|
||||||
if existingOrg != nil && err == nil {
|
if existingOrg != nil && err == nil {
|
||||||
return shared.Redirect(w, r, "/signup", http.StatusSeeOther, false)
|
return util.Redirect(w, r, "/signup", http.StatusSeeOther, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
authToken, err := auth.CreateTokenForUser("CerbervsSoft")
|
authToken, err := util.CreateTokenForUser("CerbervsSoft")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -90,7 +89,7 @@ func (c PopulateHandler) Get(w http.ResponseWriter, r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return shared.Redirect(w, r, "/signup", http.StatusSeeOther, false)
|
return util.Redirect(w, r, "/signup", http.StatusSeeOther, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserSignInForm struct {
|
type UserSignInForm struct {
|
||||||
@ -112,9 +111,9 @@ func (c SignInHandler) Get(w http.ResponseWriter, r *http.Request) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if foundUser.Admin == 1 {
|
if foundUser.Admin == 1 {
|
||||||
return shared.Redirect(w, r, "/admin/", http.StatusSeeOther, false)
|
return util.Redirect(w, r, "/admin/", http.StatusSeeOther, false)
|
||||||
} else {
|
} else {
|
||||||
return shared.Redirect(w, r, "/", http.StatusSeeOther, false)
|
return util.Redirect(w, r, "/", http.StatusSeeOther, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,10 +144,10 @@ func (c SignInHandler) Post(w http.ResponseWriter, r *http.Request) error {
|
|||||||
|
|
||||||
foundUser, err := c.Db.Repo().FindUserByUsername(fd.Username)
|
foundUser, err := c.Db.Repo().FindUserByUsername(fd.Username)
|
||||||
if foundUser == nil || err != nil {
|
if foundUser == nil || err != nil {
|
||||||
return shared.Redirect(w, r, "/sign-in", http.StatusSeeOther, false)
|
return util.Redirect(w, r, "/sign-in", http.StatusSeeOther, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
authenticated, err := auth.CheckPassword(fd.Password, foundUser.Password)
|
authenticated, err := util.CheckPassword(fd.Password, foundUser.Password)
|
||||||
if err != nil || !authenticated {
|
if err != nil || !authenticated {
|
||||||
return failWithFormError(w, r, "Invalid Username or Password.", sess)
|
return failWithFormError(w, r, "Invalid Username or Password.", sess)
|
||||||
}
|
}
|
||||||
@ -158,7 +157,7 @@ func (c SignInHandler) Post(w http.ResponseWriter, r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
token, err := auth.CreateTokenForUser(foundUser.Username)
|
token, err := util.CreateTokenForUser(foundUser.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Logger.Error(c.Logger.Wrap(err, "Error creating token"))
|
c.Logger.Error(c.Logger.Wrap(err, "Error creating token"))
|
||||||
return err
|
return err
|
||||||
@ -169,7 +168,7 @@ func (c SignInHandler) Post(w http.ResponseWriter, r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
authToken, err := auth.CreateTokenForUser(foundUser.Username)
|
authToken, err := util.CreateTokenForUser(foundUser.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Logger.Error(err)
|
c.Logger.Error(err)
|
||||||
return err
|
return err
|
||||||
@ -186,7 +185,7 @@ func (c SignInHandler) Post(w http.ResponseWriter, r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
jwtToken, err := auth.CreateTokenForUser(fd.Username)
|
jwtToken, err := util.CreateTokenForUser(fd.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -198,16 +197,16 @@ func (c SignInHandler) Post(w http.ResponseWriter, r *http.Request) error {
|
|||||||
Path: "/",
|
Path: "/",
|
||||||
})
|
})
|
||||||
|
|
||||||
//err = sess.Delete("formError")
|
err = sess.Delete("formError")
|
||||||
//if err != nil {
|
if err != nil {
|
||||||
// return err
|
return err
|
||||||
//}
|
}
|
||||||
|
|
||||||
c.Logger.Info(foundUser.Username + " logged in")
|
c.Logger.Info(foundUser.Username + " logged in")
|
||||||
if foundUser.Admin == 1 {
|
if foundUser.Admin == 1 {
|
||||||
return shared.Redirect(w, r, "/admin/", http.StatusSeeOther, false)
|
return util.Redirect(w, r, "/admin/", http.StatusSeeOther, false)
|
||||||
} else {
|
} else {
|
||||||
return shared.Redirect(w, r, "/", http.StatusSeeOther, false)
|
return util.Redirect(w, r, "/", http.StatusSeeOther, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,7 +226,7 @@ func (c SignUpHandler) Get(w http.ResponseWriter, r *http.Request) error {
|
|||||||
uname = ""
|
uname = ""
|
||||||
}
|
}
|
||||||
if uname != "" {
|
if uname != "" {
|
||||||
return shared.Redirect(w, r, "/", http.StatusSeeOther, false)
|
return util.Redirect(w, r, "/", http.StatusSeeOther, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := user.SignUpForm().Render(context.Background(), w); err != nil {
|
if err := user.SignUpForm().Render(context.Background(), w); err != nil {
|
||||||
@ -259,13 +258,13 @@ func (c SignUpHandler) Post(w http.ResponseWriter, r *http.Request) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
token, err := auth.CreateTokenForUser(fd.Username)
|
token, err := util.CreateTokenForUser(fd.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Logger.Error(c.Logger.Wrap(err, "Error creating token"))
|
c.Logger.Error(c.Logger.Wrap(err, "Error creating token"))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
password, err := auth.HashPassword(fd.PasswordConfirmation)
|
password, err := util.HashPassword(fd.PasswordConfirmation)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.Logger.Error(c.Logger.Wrap(err, "Error hashing password"))
|
c.Logger.Error(c.Logger.Wrap(err, "Error hashing password"))
|
||||||
return err
|
return err
|
||||||
@ -303,7 +302,7 @@ func (c SignUpHandler) Post(w http.ResponseWriter, r *http.Request) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
jwtToken, err := auth.CreateTokenForUser(fd.Username)
|
jwtToken, err := util.CreateTokenForUser(fd.Username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -315,7 +314,7 @@ func (c SignUpHandler) Post(w http.ResponseWriter, r *http.Request) error {
|
|||||||
Path: "/",
|
Path: "/",
|
||||||
})
|
})
|
||||||
|
|
||||||
return shared.Redirect(w, r, "/sign-in", http.StatusSeeOther, false)
|
return util.Redirect(w, r, "/sign-in", http.StatusSeeOther, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -341,7 +340,7 @@ func (c SignOutHandler) Get(w http.ResponseWriter, r *http.Request) error {
|
|||||||
Path: "/",
|
Path: "/",
|
||||||
})
|
})
|
||||||
|
|
||||||
return shared.Redirect(w, r, "/", http.StatusSeeOther, true)
|
return util.Redirect(w, r, "/", http.StatusSeeOther, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func failWithFormError(w http.ResponseWriter, r *http.Request, formError string, sess session.ISession) error {
|
func failWithFormError(w http.ResponseWriter, r *http.Request, formError string, sess session.ISession) error {
|
||||||
@ -349,5 +348,5 @@ func failWithFormError(w http.ResponseWriter, r *http.Request, formError string,
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return shared.Redirect(w, r, r.URL.Path, http.StatusSeeOther, false)
|
return util.Redirect(w, r, r.URL.Path, http.StatusSeeOther, false)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ package logger
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pterror "git.markbailey.dev/cerbervs/ptpp/lib/error"
|
pterror "git.markbailey.dev/cerbervs/ptpp/lib/error"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/util/shared"
|
"git.markbailey.dev/cerbervs/ptpp/util"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
@ -44,7 +44,7 @@ func (l CompositeLogger) getLogFile() *os.File {
|
|||||||
compositeLogFileLock.Lock()
|
compositeLogFileLock.Lock()
|
||||||
defer compositeLogFileLock.Unlock()
|
defer compositeLogFileLock.Unlock()
|
||||||
|
|
||||||
absPath := shared.GetFullyQualifiedPath("/log")
|
absPath := util.GetFullyQualifiedPath("/log")
|
||||||
|
|
||||||
err := os.MkdirAll(absPath, os.ModePerm)
|
err := os.MkdirAll(absPath, os.ModePerm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -3,7 +3,7 @@ package logger
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
pterror "git.markbailey.dev/cerbervs/ptpp/lib/error"
|
pterror "git.markbailey.dev/cerbervs/ptpp/lib/error"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/util/shared"
|
"git.markbailey.dev/cerbervs/ptpp/util"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
@ -44,7 +44,7 @@ func (l DBLogger) getLogFile() *os.File {
|
|||||||
dbLogFileLock.Lock()
|
dbLogFileLock.Lock()
|
||||||
defer dbLogFileLock.Unlock()
|
defer dbLogFileLock.Unlock()
|
||||||
|
|
||||||
absPath := shared.GetFullyQualifiedPath("/log")
|
absPath := util.GetFullyQualifiedPath("/log")
|
||||||
|
|
||||||
generalLog, err := os.OpenFile(absPath+"/db-log.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
generalLog, err := os.OpenFile(absPath+"/db-log.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2,8 +2,7 @@ package middleware
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/util/auth"
|
"git.markbailey.dev/cerbervs/ptpp/util"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/util/shared"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
@ -60,7 +59,7 @@ func WithLogger(next http.Handler) http.Handler {
|
|||||||
func WithAuth(next http.Handler) http.Handler {
|
func WithAuth(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
var (
|
var (
|
||||||
claims *auth.CustomClaims
|
claims *util.CustomClaims
|
||||||
cookie *http.Cookie
|
cookie *http.Cookie
|
||||||
err error
|
err error
|
||||||
token string
|
token string
|
||||||
@ -68,7 +67,7 @@ func WithAuth(next http.Handler) http.Handler {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if handlerSess.Get("username") != nil {
|
if handlerSess.Get("username") != nil {
|
||||||
req := shared.AddValuesToRequestContext(r, map[any]any{
|
req := util.AddValuesToRequestContext(r, map[any]any{
|
||||||
"username": handlerSess.Get("username"),
|
"username": handlerSess.Get("username"),
|
||||||
})
|
})
|
||||||
next.ServeHTTP(w, req)
|
next.ServeHTTP(w, req)
|
||||||
@ -76,19 +75,19 @@ func WithAuth(next http.Handler) http.Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if cookie, err = r.Cookie("token"); err != nil {
|
if cookie, err = r.Cookie("token"); err != nil {
|
||||||
_ = shared.Redirect(w, r, "/signin", http.StatusSeeOther, true)
|
_ = util.Redirect(w, r, "/signin", http.StatusSeeOther, true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if token = cookie.Value; token == "" {
|
if token = cookie.Value; token == "" {
|
||||||
_ = shared.Redirect(w, r, "/signin", http.StatusSeeOther, true)
|
_ = util.Redirect(w, r, "/signin", http.StatusSeeOther, true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if claims, err = auth.ParseToken(token, os.Getenv("TOKEN_SECRET")); err != nil {
|
if claims, err = util.ParseToken(token, os.Getenv("TOKEN_SECRET")); err != nil {
|
||||||
_ = shared.Redirect(w, r, "/signin", http.StatusSeeOther, true)
|
_ = util.Redirect(w, r, "/signin", http.StatusSeeOther, true)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
req := shared.AddValuesToRequestContext(r, map[any]any{
|
req := util.AddValuesToRequestContext(r, map[any]any{
|
||||||
"username": claims.Username,
|
"username": claims.Username,
|
||||||
})
|
})
|
||||||
next.ServeHTTP(w, req)
|
next.ServeHTTP(w, req)
|
||||||
@ -98,7 +97,7 @@ func WithAuth(next http.Handler) http.Handler {
|
|||||||
func WithUsername(next http.Handler) http.Handler {
|
func WithUsername(next http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
var (
|
var (
|
||||||
claims *auth.CustomClaims
|
claims *util.CustomClaims
|
||||||
cookie *http.Cookie
|
cookie *http.Cookie
|
||||||
err error
|
err error
|
||||||
token string
|
token string
|
||||||
@ -106,7 +105,7 @@ func WithUsername(next http.Handler) http.Handler {
|
|||||||
)
|
)
|
||||||
|
|
||||||
if handlerSess.Get("username") != nil {
|
if handlerSess.Get("username") != nil {
|
||||||
req := shared.AddValuesToRequestContext(r, map[any]any{
|
req := util.AddValuesToRequestContext(r, map[any]any{
|
||||||
"username": handlerSess.Get("username"),
|
"username": handlerSess.Get("username"),
|
||||||
})
|
})
|
||||||
next.ServeHTTP(w, req)
|
next.ServeHTTP(w, req)
|
||||||
@ -118,14 +117,14 @@ func WithUsername(next http.Handler) http.Handler {
|
|||||||
if token = cookie.Value; token == "" {
|
if token = cookie.Value; token == "" {
|
||||||
uname = nil
|
uname = nil
|
||||||
}
|
}
|
||||||
if claims, err = auth.ParseToken(token, os.Getenv("TOKEN_SECRET")); err != nil {
|
if claims, err = util.ParseToken(token, os.Getenv("TOKEN_SECRET")); err != nil {
|
||||||
uname = nil
|
uname = nil
|
||||||
}
|
}
|
||||||
uname = &claims.Username
|
uname = &claims.Username
|
||||||
}
|
}
|
||||||
|
|
||||||
if uname != nil {
|
if uname != nil {
|
||||||
req := shared.AddValuesToRequestContext(r, map[any]any{
|
req := util.AddValuesToRequestContext(r, map[any]any{
|
||||||
"username": uname,
|
"username": uname,
|
||||||
})
|
})
|
||||||
next.ServeHTTP(w, req)
|
next.ServeHTTP(w, req)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package auth
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
@ -1,4 +1,4 @@
|
|||||||
package shared
|
package util
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
@ -1,9 +1,6 @@
|
|||||||
package homepage
|
package homepage
|
||||||
|
|
||||||
import (
|
import "git.markbailey.dev/cerbervs/ptpp/view/layout"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/view/layout"
|
|
||||||
"git.markbailey.dev/cerbervs/ptpp/app/routing"
|
|
||||||
)
|
|
||||||
|
|
||||||
templ Homepage(env string) {
|
templ Homepage(env string) {
|
||||||
@layout.Layout() {
|
@layout.Layout() {
|
||||||
@ -12,12 +9,12 @@ templ Homepage(env string) {
|
|||||||
Welcome to the homepage
|
Welcome to the homepage
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<a href='{ routing.GetRouteByName("app.user.sign_up") }'>
|
<a href="/sign-up">
|
||||||
<button class="text-gray-400 text-md border-black rounded-lg bg-gray-300 p-2">
|
<button class="text-gray-400 text-md border-black rounded-lg bg-gray-300 p-2">
|
||||||
Sign Up
|
Sign Up
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
<a href='{ routing.GetRouteByName("app.user.sign_up") }'>
|
<a href="/sign-in">
|
||||||
<button class="text-gray-400 text-md border-black rounded-lg bg-gray-300 p-2">
|
<button class="text-gray-400 text-md border-black rounded-lg bg-gray-300 p-2">
|
||||||
Sign In
|
Sign In
|
||||||
</button>
|
</button>
|
||||||
|
@ -8,10 +8,7 @@ package homepage
|
|||||||
import "github.com/a-h/templ"
|
import "github.com/a-h/templ"
|
||||||
import templruntime "github.com/a-h/templ/runtime"
|
import templruntime "github.com/a-h/templ/runtime"
|
||||||
|
|
||||||
import (
|
import "git.markbailey.dev/cerbervs/ptpp/view/layout"
|
||||||
"git.markbailey.dev/cerbervs/ptpp/app/routing"
|
|
||||||
"git.markbailey.dev/cerbervs/ptpp/view/layout"
|
|
||||||
)
|
|
||||||
|
|
||||||
func Homepage(env string) templ.Component {
|
func Homepage(env string) templ.Component {
|
||||||
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
|
||||||
@ -46,7 +43,7 @@ func Homepage(env string) templ.Component {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
ctx = templ.InitializeContext(ctx)
|
ctx = templ.InitializeContext(ctx)
|
||||||
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"h-screen flex flex-col items-center justify-evenly text-blue-400 text-2xl\"><div>Welcome to the homepage</div><div><a href=\"{ routing.GetRouteByName("app.user.sign_up") }\"><button class=\"text-gray-400 text-md border-black rounded-lg bg-gray-300 p-2\">Sign Up</button></a> <a href=\"{ routing.GetRouteByName("app.user.sign_up") }\"><button class=\"text-gray-400 text-md border-black rounded-lg bg-gray-300 p-2\">Sign In</button></a></div></div>")
|
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("<div class=\"h-screen flex flex-col items-center justify-evenly text-blue-400 text-2xl\"><div>Welcome to the homepage</div><div><a href=\"/sign-up\"><button class=\"text-gray-400 text-md border-black rounded-lg bg-gray-300 p-2\">Sign Up</button></a> <a href=\"/sign-in\"><button class=\"text-gray-400 text-md border-black rounded-lg bg-gray-300 p-2\">Sign In</button></a></div></div>")
|
||||||
if templ_7745c5c3_Err != nil {
|
if templ_7745c5c3_Err != nil {
|
||||||
return templ_7745c5c3_Err
|
return templ_7745c5c3_Err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user