code refactor

This commit is contained in:
MaysWind
2025-07-24 23:58:24 +08:00
parent d6ee8a416f
commit d385358aa3
6 changed files with 76 additions and 60 deletions
@@ -5,15 +5,8 @@ import (
"github.com/mayswind/ezbookkeeping/pkg/settings"
)
const tokenCookieParam = "ebk_auth_token"
// AmapApiProxyAuthCookie adds amap api proxy auth cookie to cookies in response
func AmapApiProxyAuthCookie(c *core.WebContext, config *settings.Config) {
token := c.GetTextualToken()
if token != "" {
c.SetCookie(tokenCookieParam, token, int(config.TokenExpiredTime), "/_AMapService", "", false, true)
} else {
c.SetCookie(tokenCookieParam, "", -1, "/_AMapService", "", false, true)
}
c.SetTokenStringToCookie(token, int(config.TokenExpiredTime), "/_AMapService")
}