commerce/packages/sfcc/src/fetcher.ts
Dom Sip 66e3269b0e
SFCC provider (#727)
* new SFCC provider

* add search

* normalization + search

* categories as search results

* adress PR feedback

* Update README.md

* get all paths for SSG

* product variants and options

* Apply suggestions from code review

Co-authored-by: Luis Alvarez D. <luis@vercel.com>

* remove console log

* prettier

* clean console log

* ran prettier

* Updated readme

* remove static data and revert config changes

* set default site

Co-authored-by: Luis Alvarez D. <luis@vercel.com>
2022-04-20 12:08:26 -05:00

18 lines
424 B
TypeScript

import { Fetcher } from '@vercel/commerce/utils/types'
const clientFetcher: Fetcher = async ({ method, url, body }) => {
const response = await fetch(url!, {
method,
body: body ? JSON.stringify(body) : undefined,
headers: {
'Content-Type': 'application/json',
},
})
.then((response) => response.json())
.then((response) => response.data)
return response
}
export default clientFetcher