Skip to content

Commit

Permalink
Fix bug with /savedata/clear endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
patapancakes committed Apr 18, 2024
1 parent 136aac6 commit aad0668
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,14 @@ func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) {
case "/savedata/delete":
err = savedata.Delete(uuid, datatype, slot)
case "/savedata/clear":
s, ok := save.(defs.SessionSaveData)
if !ok {
httpError(w, r, fmt.Errorf("save data is not type SessionSaveData"), http.StatusBadRequest)
return
}

// doesn't return a save, but it works
save, err = savedata.Clear(uuid, slot, daily.Seed(), save.(defs.SessionSaveData))
save, err = savedata.Clear(uuid, slot, daily.Seed(), s)
}
if err != nil {
httpError(w, r, err, http.StatusInternalServerError)
Expand Down

0 comments on commit aad0668

Please sign in to comment.