refactor: more implementation to refactor

This commit is contained in:
David Allen 2025-08-04 15:58:02 -06:00
parent bfd83f35a3
commit ba684bd149
Signed by: towk
GPG key ID: 0430CDBE22619155

View file

@ -118,9 +118,9 @@ func (s *Service) CreateProfile() http.HandlerFunc {
profile *Profile `json:"profile"`
}
var (
body []byte
in input
err error
body, contents []byte
in input
err error
)
body, err = io.ReadAll(r.Body)
@ -136,8 +136,17 @@ func (s *Service) CreateProfile() http.HandlerFunc {
return
}
// serialize just the profile part
contents, err = json.Marshal(in.profile)
if err != nil {
}
// create a new profile on disk
os.WriteFile()
err = os.WriteFile(in.path, contents, os.ModePerm)
if err != nil {
}
w.WriteHeader(http.StatusOK)
}