diff --git a/services/serve/serve.go b/services/serve/serve.go
index 46cfc0a..d5a0750 100644
--- a/services/serve/serve.go
+++ b/services/serve/serve.go
@@ -1,6 +1,7 @@
package serve
import (
+ "fmt"
templEngine "github.com/davesavic/aio/services/templ"
"github.com/davesavic/aio/view"
"github.com/gin-gonic/gin"
@@ -13,8 +14,18 @@ func Run() error {
r.Use(gin.Recovery())
r.Use(gin.Logger())
+ r.GET("/login", func(ctx *gin.Context) {
+ ctx.HTML(http.StatusOK, "login", view.Login())
+ })
+ r.POST("/login", func(ctx *gin.Context) {
+ fmt.Println(ctx.PostForm("email"))
+ fmt.Println(ctx.PostForm("password"))
+
+ ctx.Redirect(http.StatusFound, "/")
+ })
+
r.GET("/", func(ctx *gin.Context) {
- ctx.HTML(http.StatusOK, "index", view.AuthorisedLayout())
+ ctx.HTML(http.StatusOK, "index", view.Dashboard())
})
return r.Run()
diff --git a/view/dashboard.templ b/view/dashboard.templ
new file mode 100644
index 0000000..94a8416
--- /dev/null
+++ b/view/dashboard.templ
@@ -0,0 +1,16 @@
+package view
+
+templ Dashboard() {
+ @AuthorisedLayout() {
+
+
+
+
+
+
+ }
+}
diff --git a/view/dashboard_templ.go b/view/dashboard_templ.go
new file mode 100644
index 0000000..68bf9f9
--- /dev/null
+++ b/view/dashboard_templ.go
@@ -0,0 +1,68 @@
+// Code generated by templ - DO NOT EDIT.
+
+// templ: version: 0.2.476
+package view
+
+//lint:file-ignore SA4006 This context is only used if a nested component is present.
+
+import "github.com/a-h/templ"
+import "context"
+import "io"
+import "bytes"
+
+func Dashboard() templ.Component {
+ return templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ ctx = templ.InitializeContext(ctx)
+ templ_7745c5c3_Var1 := templ.GetChildren(ctx)
+ if templ_7745c5c3_Var1 == nil {
+ templ_7745c5c3_Var1 = templ.NopComponent
+ }
+ ctx = templ.ClearChildren(ctx)
+ templ_7745c5c3_Var2 := templ.ComponentFunc(func(ctx context.Context, templ_7745c5c3_W io.Writer) (templ_7745c5c3_Err error) {
+ templ_7745c5c3_Buffer, templ_7745c5c3_IsBuffer := templ_7745c5c3_W.(*bytes.Buffer)
+ if !templ_7745c5c3_IsBuffer {
+ templ_7745c5c3_Buffer = templ.GetBuffer()
+ defer templ.ReleaseBuffer(templ_7745c5c3_Buffer)
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ templ_7745c5c3_Var3 := `Dashboard`
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var3)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString("
")
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = io.Copy(templ_7745c5c3_W, templ_7745c5c3_Buffer)
+ }
+ return templ_7745c5c3_Err
+ })
+ templ_7745c5c3_Err = AuthorisedLayout().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
+ if templ_7745c5c3_Err != nil {
+ return templ_7745c5c3_Err
+ }
+ if !templ_7745c5c3_IsBuffer {
+ _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteTo(templ_7745c5c3_W)
+ }
+ return templ_7745c5c3_Err
+ })
+}
diff --git a/view/layout.templ b/view/layout.templ
index 6d1b17a..2b5d51e 100644
--- a/view/layout.templ
+++ b/view/layout.templ
@@ -175,18 +175,23 @@ templ AuthorisedLayout() {
-
-
-
-
-
-
+ { children... }