package auth

import (
	"net/http"

	"haixun-backend/internal/logic/auth"
	"haixun-backend/internal/response"
	"haixun-backend/internal/svc"
)

func LogoutHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		l := auth.NewLogoutLogic(r.Context(), svcCtx)
		data, err := l.Logout(r.Header.Get("Authorization"))
		response.Write(r.Context(), w, data, err)
	}
}
