Only pass State struct pointer to StateOpen, not entire response

This commit is contained in:
Bendodroid 2024-01-14 01:53:36 +01:00
commit 70b2e8069b
Signed by: bendodroid
GPG key ID: 3EEE19A0F73D5FFC
3 changed files with 10 additions and 8 deletions

View file

@ -13,7 +13,7 @@ import (
func StateOpen(
authDB config.HTTPBACredentials, validCredentials []config.HTTPBACredentialID,
resp *types.SpaceAPIResponseV14,
resp *types.SpaceState,
) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
body := updateEndpointValidator(authDB, validCredentials, w, r)
@ -28,8 +28,8 @@ func StateOpen(
}
// Set SpaceAPI response values
resp.State.Open = newState
resp.State.LastChange = time.Now().Unix()
resp.Open = newState
resp.LastChange = time.Now().Unix()
// Respond with OK
w.WriteHeader(http.StatusOK)