summaryrefslogtreecommitdiff
path: root/api/template.go
diff options
context:
space:
mode:
authorLizzy Hunt <lizzy.hunt@usu.edu>2024-03-27 15:02:31 -0600
committerLizzy Hunt <lizzy.hunt@usu.edu>2024-03-27 15:02:31 -0600
commit0dc2679005e70c50024bc49e750f3998a0c4c24b (patch)
tree73153522195608ee2ed3bbb4c2ed3cbc621b6b07 /api/template.go
parent8d65f4e23026dce5d04e9a4afaf216f0732482a6 (diff)
downloadhatecomputers.club-0dc2679005e70c50024bc49e750f3998a0c4c24b.tar.gz
hatecomputers.club-0dc2679005e70c50024bc49e750f3998a0c4c24b.zip
authentication! oauth2!
Diffstat (limited to 'api/template.go')
-rw-r--r--api/template.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/api/template.go b/api/template.go
index c666029..a4ccfa8 100644
--- a/api/template.go
+++ b/api/template.go
@@ -22,6 +22,13 @@ func renderTemplate(context *RequestContext, templateName string, showBaseHtml b
return bytes.Buffer{}, err
}
+ if data == nil {
+ data = map[string]interface{}{}
+ }
+ if context.User != nil {
+ data.(map[string]interface{})["User"] = context.User
+ }
+
var buffer bytes.Buffer
err = tmpl.ExecuteTemplate(&buffer, "base", data)