refactor: more implementation to refactor
This commit is contained in:
parent
bfd83f35a3
commit
ba684bd149
1 changed files with 13 additions and 4 deletions
|
|
@ -118,7 +118,7 @@ func (s *Service) CreateProfile() http.HandlerFunc {
|
|||
profile *Profile `json:"profile"`
|
||||
}
|
||||
var (
|
||||
body []byte
|
||||
body, contents []byte
|
||||
in input
|
||||
err error
|
||||
)
|
||||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue