package controllers

import (
	"github.com/gofiber/fiber/v2"
)

// RENDER
func Dashboard(c *fiber.Ctx) error {
	data := fiber.Map{
		"user":    c.Locals("user").(map[string]interface{}),
		"modules": c.Locals("userModules"),
	}

	// Renderiza la vista con el layout layouts/main
	if err := c.Render("dashboard", data, "layouts/main"); err != nil {
		return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
			"message": "Error rendering template",
			"error":   err.Error(),
		})
	}
	return nil
}
