initial UI, pagination starts at 1 for some reason

This commit is contained in:
2022-04-02 13:38:14 -04:00
parent 474ea9b57c
commit 832e2025a0
7 changed files with 501 additions and 1 deletions

View File

@@ -62,13 +62,14 @@ func (c *DiscogsCache) GetAllRecords(ctx context.Context) ([]media.Record, error
func (c *DiscogsCache) fetchRecords(ctx context.Context, pagination *discogs.Pagination) ([]media.Record, error) {
records := []media.Record{}
if pagination == nil {
pagination = getPagination(0)
pagination = getPagination(1)
}
log.Printf("calling discogs API, page %v", pagination.Page)
coll, err := c.client.CollectionItemsByFolder(c.username, 0, pagination)
if err != nil {
return records, fmt.Errorf("error loading collection: %w", err)
}
log.Printf("length: %v, first item in list: %s", len(coll.Items), coll.Items[0].BasicInformation.Title)
for i := range coll.Items {
records = append(records, collectionItemToRecord(&coll.Items[i]))
}