fix: set content-type to json

This commit is contained in:
2025-06-04 20:07:39 +02:00
parent e85b23b3e8
commit 7b8fe6baf2
5 changed files with 29 additions and 0 deletions

View File

@ -137,6 +137,8 @@ func (h *AuthHandler) refreshToken(w http.ResponseWriter, r *http.Request) {
encoder := json.NewEncoder(w)
w.Header().Set("Content-Type", "application/json")
if err := encoder.Encode(Response{
AccessToken: access,
RefreshToken: refresh,
@ -213,6 +215,11 @@ func (h *AuthHandler) login(w http.ResponseWriter, r *http.Request) {
return
}
if err := h.repo.UpdateLastLogin(r.Context(), user.ID); err != nil {
web.Error(w, "failed to update user's last login", http.StatusInternalServerError)
return
}
encoder := json.NewEncoder(w)
type Response struct {