Skip to content

Commit

Permalink
Improved: api endpoint for fetching order rejection facility history (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Oct 3, 2024
1 parent 4bda099 commit 27e592a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
6 changes: 3 additions & 3 deletions src/services/OrderService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ const getProductStoreSetting = async (payload: any): Promise<any> => {
});
}

const getRerouteOrderBrokeringHistory = async (payload: any): Promise<any> => {
const getRerouteOrderFacilityChangeHistory = async (payload: any): Promise<any> => {
return api({
url: "getRerouteOrderBrokeringHistory",
url: "getRerouteOrderFacilityChangeHistory",
method: "post",
data: payload
});
Expand All @@ -58,7 +58,7 @@ const releaseRerouteOrderItem = async (payload: any): Promise<any> => {

export const OrderService = {
getOrder,
getRerouteOrderBrokeringHistory,
getRerouteOrderFacilityChangeHistory,
updateShippingAddress,
updatePickupFacility,
cancelOrderItem,
Expand Down
10 changes: 4 additions & 6 deletions src/views/Order.vue
Original file line number Diff line number Diff line change
Expand Up @@ -346,16 +346,14 @@ export default defineComponent({
let originFacilityName = "", resp;
try {
resp = await OrderService.getRerouteOrderBrokeringHistory({ "token": this.token })
resp = await OrderService.getRerouteOrderFacilityChangeHistory({ "token": this.token, facilityId: "PICKUP_REJECTED" })
if(!hasError(resp) && resp.data?.brokeringHistory.length) {
const oldestBrokeringHistory = resp.data.brokeringHistory.reduce((oldest: any, current: any) => {
return current.changeDatetime < oldest.changeDatetime ? current : oldest;
});
if(!hasError(resp) && resp.data?.facilityChangeHistory?.length) {
const fromFacilityId = resp.data.facilityChangeHistory[0]?.fromFacilityId
resp = await FacilityService.getStores({
"viewSize": process.env.VUE_APP_VIEW_SIZE,
"filters": [`storeCode: ${oldestBrokeringHistory.facilityId}`]
"filters": [`storeCode: ${fromFacilityId}`]
})
if(!hasError(resp) && resp.data.response.numFound) {
Expand Down

0 comments on commit 27e592a

Please sign in to comment.