mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-22 19:57:43 +00:00
fix thing listing
This commit is contained in:
parent
209f52fcf4
commit
a10ca40cb6
1 changed files with 3 additions and 2 deletions
|
@ -109,16 +109,17 @@ func NewListingResponse(val *fastjson.Value) *ListingResponse {
|
||||||
lr := &ListingResponse{}
|
lr := &ListingResponse{}
|
||||||
|
|
||||||
data := val.Get("data")
|
data := val.Get("data")
|
||||||
|
children := data.GetArray("children")
|
||||||
|
|
||||||
lr.After = string(data.GetStringBytes("after"))
|
lr.After = string(data.GetStringBytes("after"))
|
||||||
lr.Before = string(data.GetStringBytes("before"))
|
lr.Before = string(data.GetStringBytes("before"))
|
||||||
lr.Count = data.GetInt("dist")
|
lr.Count = len(children)
|
||||||
|
|
||||||
if lr.Count == 0 {
|
if lr.Count == 0 {
|
||||||
return lr
|
return lr
|
||||||
}
|
}
|
||||||
|
|
||||||
lr.Children = make([]*Thing, lr.Count)
|
lr.Children = make([]*Thing, lr.Count)
|
||||||
children := data.GetArray("children")
|
|
||||||
for i := 0; i < lr.Count; i++ {
|
for i := 0; i < lr.Count; i++ {
|
||||||
t := NewThing(children[i])
|
t := NewThing(children[i])
|
||||||
lr.Children[i] = t
|
lr.Children[i] = t
|
||||||
|
|
Loading…
Reference in a new issue