mirror of
https://github.com/vercel/commerce.git
synced 2025-07-27 04:01:23 +00:00
Rename fetch
This commit is contained in:
@@ -17,10 +17,10 @@ export default function getAllProductPathsOperation({
|
||||
config?: Partial<OrdercloudConfig>
|
||||
} = {}): Promise<T['data']> {
|
||||
// Get fetch from the config
|
||||
const { storeRestFetch } = commerce.getConfig(config)
|
||||
const { restFetch } = commerce.getConfig(config)
|
||||
|
||||
// Get all products
|
||||
const rawProducts: RawProduct[] = await storeRestFetch<{
|
||||
const rawProducts: RawProduct[] = await restFetch<{
|
||||
Items: RawProduct[]
|
||||
}>('GET', '/me/products').then((response) => response.Items)
|
||||
|
||||
|
@@ -18,10 +18,10 @@ export default function getAllProductsOperation({
|
||||
preview?: boolean
|
||||
} = {}): Promise<T['data']> {
|
||||
// Get fetch from the config
|
||||
const { storeRestFetch } = commerce.getConfig(config)
|
||||
const { restFetch } = commerce.getConfig(config)
|
||||
|
||||
// Get all products
|
||||
const rawProducts: RawProduct[] = await storeRestFetch<{
|
||||
const rawProducts: RawProduct[] = await restFetch<{
|
||||
Items: RawProduct[]
|
||||
}>('GET', '/me/products').then((response) => response.Items)
|
||||
|
||||
|
@@ -19,22 +19,22 @@ export default function getProductOperation({
|
||||
preview?: boolean
|
||||
} = {}): Promise<T['data']> {
|
||||
// Get fetch from the config
|
||||
const { storeRestFetch } = commerce.getConfig(config)
|
||||
const { restFetch } = commerce.getConfig(config)
|
||||
|
||||
// Get a single product
|
||||
const productPromise = storeRestFetch<RawProduct>(
|
||||
const productPromise = restFetch<RawProduct>(
|
||||
'GET',
|
||||
`/me/products/${variables?.slug}`
|
||||
)
|
||||
|
||||
// Get product specs
|
||||
const specsPromise = storeRestFetch<{ Items: RawSpec[] }>(
|
||||
const specsPromise = restFetch<{ Items: RawSpec[] }>(
|
||||
'GET',
|
||||
`/me/products/${variables?.slug}/specs`
|
||||
).then((res) => res.Items)
|
||||
|
||||
// Get product variants
|
||||
const variantsPromise = storeRestFetch<{ Items: RawVariant[] }>(
|
||||
const variantsPromise = restFetch<{ Items: RawVariant[] }>(
|
||||
'GET',
|
||||
`/me/products/${variables?.slug}/variants`
|
||||
).then((res) => res.Items)
|
||||
|
@@ -23,10 +23,10 @@ export default function getSiteInfoOperation({
|
||||
preview?: boolean
|
||||
} = {}): Promise<T['data']> {
|
||||
// Get fetch from the config
|
||||
const { storeRestFetch } = commerce.getConfig(config)
|
||||
const { restFetch } = commerce.getConfig(config)
|
||||
|
||||
// Get list of categories
|
||||
const rawCategories: RawCategory[] = await storeRestFetch<{
|
||||
const rawCategories: RawCategory[] = await restFetch<{
|
||||
Items: RawCategory[]
|
||||
}>('GET', `/me/categories`).then((response) => response.Items)
|
||||
|
||||
|
Reference in New Issue
Block a user