example/server/exampleop/templates.go
raw| 1 | package exampleop |
| 2 | |
| 3 | import ( |
| 4 | "embed" |
| 5 | "html/template" |
| 6 | "log/slog" |
| 7 | ) |
| 8 | |
| 9 | var ( |
| 10 | //go:embed templates |
| 11 | templateFS embed.FS |
| 12 | templates = template.Must(template.ParseFS(templateFS, "templates/*.html")) |
| 13 | ) |
| 14 | |
| 15 | const ( |
| 16 | queryAuthRequestID = "authRequestID" |
| 17 | ) |
| 18 | |
| 19 | func errMsg(err error) string { |
| 20 | if err == nil { |
| 21 | return "" |
| 22 | } |
| 23 | slog.Error("template error", "error", err) |
| 24 | return err.Error() |
| 25 | } |