feat: add public product detail web flow
This commit is contained in:
@@ -19,6 +19,17 @@ export async function getPublicListing(id) {
|
||||
throw new Error(response.status === 404 ? 'Listing not found.' : 'Listing is unavailable.');
|
||||
}
|
||||
|
||||
const payload = await response.json();
|
||||
return payload.data;
|
||||
}
|
||||
|
||||
export async function getPublicProduct(slug) {
|
||||
const response = await fetch(`${apiBaseUrl}/public/products/${encodeURIComponent(slug)}`);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(response.status === 404 ? 'Product not found.' : 'Product is unavailable.');
|
||||
}
|
||||
|
||||
const payload = await response.json();
|
||||
return payload.data;
|
||||
}
|
||||
Reference in New Issue
Block a user