summaryrefslogtreecommitdiffci
path: root/internal/router/handlers/api-v1-subs-put.go
diff refs
from: back
to: back
| flip
diff options
context:
space:
mode:
Diffstat (limited to 'internal/router/handlers/api-v1-subs-put.go')
-rw-r--r--internal/router/handlers/api-v1-subs-put.go11
1 files changed, 3 insertions, 8 deletions
diff --git a/internal/router/handlers/api-v1-subs-put.go b/internal/router/handlers/api-v1-subs-put.go
index 12dc5cf..144abe5 100644
--- a/internal/router/handlers/api-v1-subs-put.go
+++ b/internal/router/handlers/api-v1-subs-put.go
@@ -3,7 +3,6 @@ package handlers
import (
"github.com/SayaAndy/saya-today-web/internal/mailer"
"github.com/SayaAndy/saya-today-web/internal/router"
- "github.com/SayaAndy/saya-today-web/l10n"
"github.com/gofiber/fiber/v2"
)
@@ -35,10 +34,6 @@ func (r *PutSubsHandler) ToValidateLang() router.LangSetting {
return router.InReferer
}
-func (r *PutSubsHandler) RateLimiter() *fiber.Handler {
- return &router.RateLimiterMedium
-}
-
func (r *PutSubsHandler) Render(c *fiber.Ctx, supplements *router.Supplements, lang string, templateMap fiber.Map) (statusCode int, err error) {
templateMap["StatusId"] = "subs-message"
@@ -53,18 +48,18 @@ func (r *PutSubsHandler) Render(c *fiber.Ctx, supplements *router.Supplements, l
subscriptionTypeEnum = mailer.Specific
default:
templateMap["Status"] = "Failed"
- templateMap["Message"] = l10n.T.GetPath(lang, "UserProfile", "SubscribeInvalidType").(string)
+ templateMap["Message"] = supplements.Localization[lang].UserProfile.SubscribeInvalidType
return fiber.StatusUnprocessableEntity, nil
}
specificTags := c.FormValue("tags_picked")
if err = supplements.Mailer.Subscribe(supplements.Mailer.GetHash(c.IP()), subscriptionTypeEnum, specificTags); err != nil {
templateMap["Status"] = "Failed"
- templateMap["Message"] = l10n.T.GetPath(lang, "UserProfile", "FailedToSubscribe").(string)
+ templateMap["Message"] = supplements.Localization[lang].UserProfile.FailedToSubscribe
return fiber.StatusUnprocessableEntity, nil
}
templateMap["Status"] = "OK"
- templateMap["Message"] = l10n.T.GetPath(lang, "UserProfile", "SubscribedSuccessfully").(string)
+ templateMap["Message"] = supplements.Localization[lang].UserProfile.SubscribedSuccessfully
return fiber.StatusOK, nil
}