aboutsummaryrefslogtreecommitdiff
path: root/utils/shortcuts/render.go
diff options
context:
space:
mode:
authorBobby <[email protected]>2026-03-07 14:25:54 +0530
committerBobby <[email protected]>2026-03-07 14:25:54 +0530
commit41926c10ea2e8496ce4b528262f5047ccbe6f155 (patch)
tree67ff5a27bb50faec368cf7ef38a1b1f2866459dd /utils/shortcuts/render.go
parented2a033d7c08e448f5c6fd035e2de8f51431b597 (diff)
downloaddove-41926c10ea2e8496ce4b528262f5047ccbe6f155.tar.xz
dove-41926c10ea2e8496ce4b528262f5047ccbe6f155.zip
Implement authentication system with login/logout functionality and session management
Diffstat (limited to 'utils/shortcuts/render.go')
-rw-r--r--utils/shortcuts/render.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/utils/shortcuts/render.go b/utils/shortcuts/render.go
new file mode 100644
index 0000000..29c7a8f
--- /dev/null
+++ b/utils/shortcuts/render.go
@@ -0,0 +1,22 @@
+package shortcuts
+
+import "github.com/gofiber/fiber/v2"
+
+func Render(context *fiber.Ctx, templateName string, data any) error {
+ templateData := make(fiber.Map)
+
+ mergeContextValues(context, templateData)
+
+ if data != nil {
+ if mergeError := mergeBindData(templateData, data); mergeError != nil {
+ return mergeError
+ }
+ }
+
+ return context.Render(templateName, templateData)
+}
+
+func RenderWithStatus(context *fiber.Ctx, templateName string, data any, statusCode int) error {
+ context.Status(statusCode)
+ return Render(context, templateName, data)
+}