package chat

import (
	"net/http"

	"github.com/zeromicro/go-zero/rest/httpx"

	"wechat-api/internal/logic/chat"
	"wechat-api/internal/svc"
)

// swagger:route get /v1/chat/getauth chat GetAuth
//

//

//
// Responses:
//  200: BaseMsgResp

func GetAuthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := chat.NewGetAuthLogic(r.Context(), svcCtx)
		resp, err := l.GetAuth()
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
		} else {
			httpx.OkJsonCtx(r.Context(), w, resp)
		}
	}
}
