mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 13:41:22 +00:00
23 lines
375 B
TypeScript
23 lines
375 B
TypeScript
import { Product } from '@commerce/types'
|
|
|
|
import api from '../api/product'
|
|
|
|
interface GetProduct {
|
|
product?: Product
|
|
}
|
|
|
|
interface Parameters {
|
|
variables: {
|
|
slug?: string
|
|
}
|
|
preview?: boolean
|
|
}
|
|
|
|
const getProduct = async ({ variables }: Parameters): Promise<GetProduct> => {
|
|
return {
|
|
product: await api.fetch(variables.slug),
|
|
}
|
|
}
|
|
|
|
export default getProduct
|