Skip to content

Commit

Permalink
settingItem fix
Browse files Browse the repository at this point in the history
  • Loading branch information
rucsi committed Jan 9, 2024
1 parent 55ebdd7 commit 450ba6b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions internal/api/cms.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ type entryItem struct {
Schema content.Schema `json:"schema,omitempty"`
}

type settingItem struct {
Label string `json:"label"`
Models []string `json:"models"`
}

type settings struct {
Name string `json:"name"`
Content map[string]*settingItem `json:"content"`
}

var (
shaCache = cache.NewGeneric[ComponentsTreeSha](30 * time.Minute)
)
Expand Down Expand Up @@ -657,14 +667,13 @@ func getSetting(w http.ResponseWriter, r *http.Request) {
return
}

contentData := &content.ContentData{}
err = json.Unmarshal([]byte(blob), contentData)
contentData := make(map[string]*settingItem)
err = json.Unmarshal([]byte(blob), &contentData)
if err != nil {
errCmsParseBlob().Status(http.StatusInternalServerError).Log(r, err).Json(w)
return
}

data := &entryItem{Name: *fc.Name, Content: contentData}
data := &settings{Name: *fc.Name, Content: contentData}
jsonResponse(w, http.StatusOK, data)
}

Expand Down

0 comments on commit 450ba6b

Please sign in to comment.