Timer token show & reset
This commit is contained in:
@ -5,6 +5,22 @@ import (
|
||||
"stevenlr.com/timer/model"
|
||||
)
|
||||
|
||||
templ TimerTokenForm(timer model.Timer) {
|
||||
<p class="token-form">
|
||||
<button
|
||||
type="button"
|
||||
hx-post={ fmt.Sprint("/timer/", timer.Id, "/resetToken") }
|
||||
hx-target="closest .token-form"
|
||||
hx-confirm="Are you sure you want to reset the token for this timer?"
|
||||
>Reset token</button>
|
||||
<button
|
||||
type="button"
|
||||
hx-get={ fmt.Sprint("/timer/", timer.Id, "/token") }
|
||||
hx-swap="outerHTML"
|
||||
>Show token</button>
|
||||
</p>
|
||||
}
|
||||
|
||||
templ TimerView(timer model.Timer) {
|
||||
<div class="timer">
|
||||
<h1>Timer "{ timer.Name }"</h1>
|
||||
@ -38,6 +54,8 @@ templ TimerView(timer model.Timer) {
|
||||
<button hx-target="closest .timer" hx-post={ fmt.Sprint("/timer/", timer.Id, "/addTime/4w") }>4 weeks</button>
|
||||
</p>
|
||||
}
|
||||
<h3>API token</h3>
|
||||
@TimerTokenForm(timer)
|
||||
</div>
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user