This commit is contained in:
2024-12-19 14:01:14 +08:00
parent afbbf1ee31
commit 200c48a22c
15 changed files with 178 additions and 106 deletions

View File

@@ -1,9 +1,12 @@
package err
import "github.com/zhang2092/go-url-shortener/internal/templ/base"
import (
"github.com/zhang2092/go-url-shortener/internal/templ/base"
"net/http"
)
templ Error404() {
@base.Base() {
templ Error404(r *http.Request) {
@base.Base(r, nil, nil) {
<h1>404</h1>
<p>当前短路径已经失效</p>
}

View File

@@ -8,9 +8,12 @@ package err
import "github.com/a-h/templ"
import templruntime "github.com/a-h/templ/runtime"
import "github.com/zhang2092/go-url-shortener/internal/templ/base"
import (
"github.com/zhang2092/go-url-shortener/internal/templ/base"
"net/http"
)
func Error404() templ.Component {
func Error404(r *http.Request) templ.Component {
return templruntime.GeneratedTemplate(func(templ_7745c5c3_Input templruntime.GeneratedComponentInput) (templ_7745c5c3_Err error) {
templ_7745c5c3_W, ctx := templ_7745c5c3_Input.Writer, templ_7745c5c3_Input.Context
if templ_7745c5c3_CtxErr := ctx.Err(); templ_7745c5c3_CtxErr != nil {
@@ -49,7 +52,7 @@ func Error404() templ.Component {
}
return templ_7745c5c3_Err
})
templ_7745c5c3_Err = base.Base().Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
templ_7745c5c3_Err = base.Base(r, nil, nil).Render(templ.WithChildren(ctx, templ_7745c5c3_Var2), templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}