UNPKG

commerce-vuex

Version:
24 lines (20 loc) 675 B
import { auth, nav } from 'oak-vuex' const { getHubAuthHeader } = auth const { wrapRequest } = nav const retainHubApiUrl = process.env.VUE_APP_RETAINHUB_COMMERCE_API_URL const retainhubHubName = process.env.VUE_APP_RETAINHUB_NAME const doPortfolioLookup = wrapRequest(({ nameLike, type }) => { const requestOptions = { method: 'POST', headers: { 'Content-type': 'application/json', 'Prefer': 'count=estimated', ...getHubAuthHeader(retainhubHubName) }, body: JSON.stringify( { name: nameLike, scope: type }) } return fetch(`${retainHubApiUrl}/rpc/portfolio_lookup`, requestOptions) }) export default { doPortfolioLookup }