User login & logout

This commit is contained in:
2024-04-15 23:17:09 +02:00
parent 6ceda23af4
commit 3d507d36ea
6 changed files with 282 additions and 8 deletions

View File

@ -10,7 +10,11 @@ import "context"
import "io"
import "bytes"
func Main(contents templ.Component) templ.Component {
import (
"stevenlr.com/timer/model"
)
func Main(contents templ.Component, currentUser *model.User) 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 {
@ -27,6 +31,10 @@ func Main(contents templ.Component) templ.Component {
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = LoginForm(currentUser).Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
templ_7745c5c3_Err = contents.Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err