22 lines
392 B
Go
22 lines
392 B
Go
package server
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"net/http"
|
||
|
|
|
||
|
|
"g.fc.run/misc/byre/internal/api"
|
||
|
|
)
|
||
|
|
|
||
|
|
func (s *Server) UpdateNotificationPrefs(w http.ResponseWriter, r *http.Request) {
|
||
|
|
req := api.NotificationPrefs{}
|
||
|
|
if !readJSON(w, r, &req) {
|
||
|
|
return
|
||
|
|
}
|
||
|
|
|
||
|
|
u, err := s.store.UpdateNotificationPrefs(r.Context(), actor(r), req)
|
||
|
|
if err != nil {
|
||
|
|
writeStoreError(w, err)
|
||
|
|
return
|
||
|
|
}
|
||
|
|
writeJSON(w, http.StatusOK, u)
|
||
|
|
}
|