UNPKG

lin3s-sylius-shop-api-client

Version:

JavaScript client on top of SyliusShopApiPlugin to build integrations with ease.

25 lines (20 loc) 625 B
import axios from 'axios'; import merge from 'lodash.merge'; import session from '../session'; import {authParams, contentTypeJson, localeParams} from '../requestConfig'; export default (config) => ({notes, ...rest}) => { return new Promise((resolve, reject) => { const headers = merge( authParams(config), localeParams(config), contentTypeJson(config) ); axios.put( `${config.baseUrl}/shop-api/checkout/${session(config).Cart.id()}/complete`, {notes, ...rest}, headers ) .then(response => resolve(response.data)) .catch(error => reject(error)); }); };