在哪里可以找到或创建 Spree 的产品缩略图 API

Where to find or create product thumbnails for Spree API

我正在设法创建一个从 Spree 调用产品 API 的页面。我将 Spree API 用于我的电子商务解决方案,该解决方案内置于他们的框架中并自动设置。前端通过react-rails gem.

使用ReactJS

我找不到 Spree V2 API 产品 link 中图像的 URL。它没有在文档和 API JSON 来源中提及。我只在 API 响应中看到类型和 ID。

我的存储库:https://github.com/salman15/stern_spree_react

我尝试显示类型,但显示为空。

<p>Shop Products</p>
        {this.state.products.map(product =>
          <li key={product.objectID}>
            <p>{product.attributes.price}</p>
              <Card>
                  <CardActionArea>
                    <CardMedia
                      
                      image={product.relationships.images.data.type}
                      title={product.attributes.name}
                    />
                    <CardContent>
                      <Typography gutterBottom variant="h5" component="h2">
                       {product.attributes.name}
                      </Typography>
                      <Typography component="p">
                        Lizards are a widespread group of squamate reptiles, with over 6,000 species, ranging
                        across all continents except Antarctica
                      </Typography>
                    </CardContent>
                  </CardActionArea>
                  <CardActions>
                    <Button size="small" color="primary">
                      Share
                    </Button>
                    <Button size="small" color="primary">
                      Learn More
                    </Button>
                  </CardActions>
                </Card>
          </li>
        )}

我收到了 Spree 开发者的回复

you can grab images from the Products API by specifying that you want them to be returned in the response - please take a look at the include parameter https://guides.spreecommerce.org/api/v2/storefront#operation/Show%20Product