create and get categories with database for user
This commit is contained in:
1 parent
2c06975a43
commit
90e5863adc
12 files changed
+189
-79
No files matched your search
@@ -4,10 +4,14 @@ import (
|
||||
"backend/database"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/golang-jwt/jwt/v5"
|
||||
)
|
||||
|
||||
func GetAllCategories(c *fiber.Ctx) error {
|
||||
categories, err := database.GetAllCategories()
|
||||
user := c.Locals("user").(*jwt.Token)
|
||||
claims := user.Claims.(jwt.MapClaims)
|
||||
userid := claims["id"].(string)
|
||||
categories, err := database.GetAllCategories(userid)
|
||||
if err != nil {
|
||||
return c.Status(fiber.StatusInternalServerError).JSON(fiber.Map{
|
||||
"error": err.Error(),
|
||||
|
||||
Reference in new issue
Block a user