From 1e806f1a3453fc8be3312114b709d4e3e979511e Mon Sep 17 00:00:00 2001 From: Maxim Khailo Date: Tue, 31 Jan 2017 17:36:19 -0800 Subject: [PATCH] The admin search view is no longer available. Use phoenix instead. The admin search view should not have been available to search orders. This was abused in the storefronts to create the my orders pages. There was a bug in isaac that let this happen and now it has been fixed. So this search view is no longer available to customer JWTs. Unfortunately this will return a different payload than the search view. This requires fixing the storefronts. --- src/api/orders.js | 25 +------------------------ src/endpoints.js | 2 +- 2 files changed, 2 insertions(+), 25 deletions(-) diff --git a/src/api/orders.js b/src/api/orders.js index a4904ec..d39ca20 100644 --- a/src/api/orders.js +++ b/src/api/orders.js @@ -3,23 +3,6 @@ import * as endpoints from '../endpoints'; -function buildQuery(customerId) { - return { - 'query': { - 'nested': { - 'path': 'customer', - 'query': { - 'term': { - 'customer.id': { - 'value': customerId - } - } - } - } - } - } -} - export default class Orders { constructor(api) { this.api = api; @@ -27,13 +10,7 @@ export default class Orders { // @method list(): Promise list() { - const customerId = this.api.getCustomerId(); - if (customerId != null) { - const query = buildQuery(customerId); - return this.api.post(endpoints.orders, query); - } else { - return Promise.reject(new Error('api.orders.list: can\'t do request, please sign in first')); - } + return this.api.get(endpoints.orders); } // @method get(referenceNumber: string): Promise diff --git a/src/endpoints.js b/src/endpoints.js index 2dda342..4bfa486 100644 --- a/src/endpoints.js +++ b/src/endpoints.js @@ -52,5 +52,5 @@ export const account = '/v1/my/account'; export const changePassword = '/v1/my/account/change-password'; // orders endpoints -export const orders = '/search/admin/orders_search_view/_search'; +export const orders = '/v1/my/orders'; export const order = referenceNumber => `/v1/my/orders/${referenceNumber}`;