mirror of
https://github.com/vercel/commerce.git
synced 2025-05-08 18:57:51 +00:00
use new endpoint
This commit is contained in:
parent
b6ba260b77
commit
30087c63c8
@ -97,15 +97,13 @@ export async function getCollectionProducts({
|
|||||||
*/
|
*/
|
||||||
export async function getProduct({ handle, currency } : { handle: string, currency: string }): Promise<Product | undefined> {
|
export async function getProduct({ handle, currency } : { handle: string, currency: string }): Promise<Product | undefined> {
|
||||||
// TODO: replace with real URL
|
// TODO: replace with real URL
|
||||||
const res = await fourthwallGet<{results: FourthwallProduct[]}>(`${API_URL}/api/public/v1.0/collections/${process.env.FW_COLLECTION}/products?secret=${API_SECRET}¤cy=${currency}`, {
|
const res = await fourthwallGet<FourthwallProduct>(`${API_URL}/api/public/v1.0/products/${handle}?secret=${API_SECRET}¤cy=${currency}`, {
|
||||||
headers: {
|
headers: {
|
||||||
'X-ShopId': process.env.FW_SHOPID || ''
|
'X-ShopId': process.env.FW_SHOPID || ''
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return res.body.results.filter((product) => {
|
return reshapeProduct(res.body);
|
||||||
return product.slug === handle
|
|
||||||
}).map((p: any) => reshapeProduct(p))[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getProductRecommendations(productId: string): Promise<Product[]> {
|
export async function getProductRecommendations(productId: string): Promise<Product[]> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user