Rename fetch

This commit is contained in:
goncy
2021-08-26 14:59:21 -03:00
parent 9e14314d22
commit 017380515c
9 changed files with 30 additions and 30 deletions

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)

View File

@@ -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)