2022-09-18 19:28:56 +03:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2022-10-23 15:26:51 +03:00
|
|
|
|
2022-09-25 11:04:32 +03:00
|
|
|
"github.com/Redume/EveryNasa/functions"
|
2022-10-23 15:26:51 +03:00
|
|
|
"github.com/gofiber/fiber/v2"
|
2022-09-18 19:28:56 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func Message(status bool, message string) map[string]interface{} {
|
|
|
|
return map[string]interface{}{"status": status, "message": message}
|
|
|
|
}
|
|
|
|
|
2022-10-23 15:26:51 +03:00
|
|
|
func Respond(c *fiber.Ctx, data map[string]interface{}) {
|
|
|
|
c.Set("Content-Type", "application/json")
|
|
|
|
err := json.NewEncoder(c).Encode(data)
|
2022-09-19 02:06:28 +03:00
|
|
|
if err != nil {
|
2022-09-25 11:04:32 +03:00
|
|
|
functions.Logger(err.Error())
|
2022-09-19 02:06:28 +03:00
|
|
|
}
|
2022-09-18 19:28:56 +03:00
|
|
|
}
|