diff --git a/lib/constants.ts b/lib/constants.ts index ceb829eb73..c09b78eafe 100644 --- a/lib/constants.ts +++ b/lib/constants.ts @@ -26,3 +26,10 @@ export const TAGS = { }; export const SYLIUS_API_ENDPOINT = '/api/v2/shop'; + +export const REST_METHODS = { + GET: 'GET', + POST: 'POST', + PUT: 'PUT', + DELETE: 'DELETE' +}; diff --git a/lib/sylius/index.ts b/lib/sylius/index.ts index 0d18b984b5..8e8844918c 100644 --- a/lib/sylius/index.ts +++ b/lib/sylius/index.ts @@ -1,4 +1,4 @@ -import { SYLIUS_API_ENDPOINT } from 'lib/constants'; +import { REST_METHODS, SYLIUS_API_ENDPOINT } from 'lib/constants'; const DOMAIN = `${process.env.SYLIUS_STORE_DOMAIN}`; const ENDPOINT = `${DOMAIN}${SYLIUS_API_ENDPOINT}`; @@ -53,7 +53,7 @@ export const getCollectionProducts = () => []; // Cart export const createCart = async () => { - const cart = await syliusRequest('POST', '/orders', { localeCode: 'fr_FR' }); + const cart = await syliusRequest(REST_METHODS.POST, '/orders', { localeCode: 'fr_FR' }); return cart; }; export const getCart = (cartId: string) => {