35 lines
593 B
Go
35 lines
593 B
Go
package response
|
|
|
|
import (
|
|
"fmt"
|
|
"lishwist/http/templates"
|
|
|
|
"github.com/Teajey/rsvp"
|
|
)
|
|
|
|
func NotFound() rsvp.Body {
|
|
return Error("Page not found").StatusNotFound()
|
|
}
|
|
|
|
type errorProps struct {
|
|
Navbar templates.NavCollapse
|
|
Message string
|
|
}
|
|
|
|
func Error(format string, a ...any) rsvp.Body {
|
|
return rsvp.Body{
|
|
Data: errorProps{
|
|
Message: fmt.Sprintf(format, a...),
|
|
Navbar: templates.DefaultNavCollapse(),
|
|
},
|
|
TemplateName: "error_page.gotmpl",
|
|
}
|
|
}
|
|
|
|
func Data(templateName string, body any) rsvp.Body {
|
|
return rsvp.Body{
|
|
Data: body,
|
|
TemplateName: templateName,
|
|
}
|
|
}
|