#73 add sign out
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 48s
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 48s
This commit is contained in:
@@ -5,9 +5,9 @@ templ SignInOrUp(isSignIn bool) {
|
||||
class="max-w-xl px-2 mx-auto flex flex-col gap-4 h-full justify-center"
|
||||
method="POST"
|
||||
if isSignIn {
|
||||
hx-post="/api/auth/signin"
|
||||
action="/api/auth/signin"
|
||||
} else {
|
||||
hx-post="/api/auth/signup"
|
||||
action="/api/auth/signup"
|
||||
}
|
||||
>
|
||||
<h2 class="text-6xl mb-10">
|
||||
|
||||
14
template/auth/user.templ
Normal file
14
template/auth/user.templ
Normal file
@@ -0,0 +1,14 @@
|
||||
package auth
|
||||
|
||||
templ UserComp(user string) {
|
||||
<div id="user-info" class="flex gap-5">
|
||||
if user != "" {
|
||||
<a hx-get="/api/auth/signout" hx-target="#user-info" class="btn btn-sm">Sign Out</a>
|
||||
<!-- <a href="/api/auth/signout" class="btn btn-sm">Sign Out</a> -->
|
||||
{ user }
|
||||
} else {
|
||||
<a href="/auth/signup" class="btn btn-sm">Sign Up</a>
|
||||
<a href="/auth/signin" class="btn btn-sm">Sign In</a>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package template
|
||||
|
||||
templ Layout(comp templ.Component) {
|
||||
templ Layout(slot templ.Component, user templ.Component) {
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
@@ -19,12 +19,11 @@ templ Layout(comp templ.Component) {
|
||||
<img src="/static/favicon.svg" alt="ME-FIT logo"/>
|
||||
<span>ME-FIT</span>
|
||||
</a>
|
||||
<a href="/auth/signup" class="btn btn-sm">Sign Up</a>
|
||||
<a href="/auth/signin" class="btn btn-sm">Sign In</a>
|
||||
@user
|
||||
</div>
|
||||
<div class="flex-1">
|
||||
if comp != nil {
|
||||
@comp
|
||||
if slot != nil {
|
||||
@slot
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user