diff --git a/src/components/ProductListItem.vue b/src/components/ProductListItem.vue deleted file mode 100644 index e312f8f5..00000000 --- a/src/components/ProductListItem.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - {{ product.productName }} - {{ product.sku }} - {{$filters.getFeature(product.featureHierarchy, '1/COLOR/')}} | {{$filters.getFeature(product.featureHierarchy, '1/SIZE/')}} - - - - - \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index cc3c421c..8a70521d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -50,15 +50,6 @@ app.config.globalProperties.$filters = { const userProfile = store.getters['user/getUserProfile']; // TODO Fix this setDefault should set the default timezone instead of getting it everytiem and setting the tz return DateTime.utc(value, inFormat).setZone(userProfile.userTimeZone).toFormat(outFormat ? outFormat : 'MM-DD-YYYY') - }, - getFeature(featureHierarchy: any, featureKey: string) { - let featureValue = '' - if (featureHierarchy) { - const feature = featureHierarchy.find((featureItem: any) => featureItem.startsWith(featureKey)) - const featureSplit = feature ? feature.split('/') : []; - featureValue = featureSplit[2] ? featureSplit[2] : ''; - } - return featureValue; } } diff --git a/src/services/ProductService.ts b/src/services/ProductService.ts deleted file mode 100644 index 48848dd3..00000000 --- a/src/services/ProductService.ts +++ /dev/null @@ -1,15 +0,0 @@ -import api from '@/api'; - -const fetchProducts = async (query: any): Promise => { - return api({ - // TODO: We can replace this with any API - url: "searchProducts", - method: "post", - data: query, - cache: true - }); -} - -export const ProductService = { - fetchProducts -} \ No newline at end of file diff --git a/src/store/modules/product/ProductState.ts b/src/store/modules/product/ProductState.ts index 741a4488..740608b5 100644 --- a/src/store/modules/product/ProductState.ts +++ b/src/store/modules/product/ProductState.ts @@ -1,7 +1,3 @@ export default interface ProductState { cached: any; - products: { - list: any; - total: number; - } } \ No newline at end of file diff --git a/src/store/modules/product/actions.ts b/src/store/modules/product/actions.ts index 6a04e7f9..74938648 100644 --- a/src/store/modules/product/actions.ts +++ b/src/store/modules/product/actions.ts @@ -1,11 +1,7 @@ -import { ProductService } from "@/services/ProductService"; import { ActionTree } from 'vuex' import RootState from '@/store/RootState' import ProductState from './ProductState' import * as types from './mutation-types' -import { hasError, showToast } from '@/utils' -import { translate } from '@/i18n' -import emitter from '@/event-bus' import { fetchProducts, isError } from "@/adapter"; const actions: ActionTree = { @@ -39,43 +35,6 @@ const actions: ActionTree = { // TODO Handle specific error return resp; }, - - // Find Product - async findProduct ({ commit, state }, payload) { - - // Show loader only when new query and not the infinite scroll - if (payload.viewIndex === 0) emitter.emit("presentLoader"); - - let resp; - - try { - resp = await ProductService.fetchProducts({ - // used sku as we are currently only using sku to search for the product - "filters": ['sku: ' + payload.queryString], - "viewSize": payload.viewSize, - "viewIndex": payload.viewIndex - }) - - // resp.data.response.numFound tells the number of items in the response - if (resp.status === 200 && resp.data.response.numFound > 0 && !hasError(resp)) { - let products = resp.data.response.docs; - const totalProductsCount = resp.data.response.numFound; - - if (payload.viewIndex && payload.viewIndex > 0) products = state.products.list.concat(products) - commit(types.PRODUCT_SEARCH_UPDATED, { products: products, totalProductsCount: totalProductsCount }) - } else { - //showing error whenever getting no products in the response or having any other error - showToast(translate("Product not found")); - } - // Remove added loader only when new query and not the infinite scroll - if (payload.viewIndex === 0) emitter.emit("dismissLoader"); - } catch(error){ - console.error(error) - showToast(translate("Something went wrong")); - } - // TODO Handle specific error - return resp; - }, } export default actions; diff --git a/src/store/modules/product/getters.ts b/src/store/modules/product/getters.ts index d0b50a36..fc9604c7 100644 --- a/src/store/modules/product/getters.ts +++ b/src/store/modules/product/getters.ts @@ -6,15 +6,6 @@ const getters: GetterTree = { getProduct: (state) => (productId: string) => { // Returning empty object so that it doesn't breaks the UI return state.cached[productId] ? state.cached[productId] : {}; - }, - getSearchProducts(state) { - return state.products.list; - }, - isScrollable(state) { - return ( - state.products.list.length > 0 && - state.products.list.length < state.products.total - ); - }, + } }; export default getters; \ No newline at end of file diff --git a/src/store/modules/product/index.ts b/src/store/modules/product/index.ts index 628ce332..4d67f460 100644 --- a/src/store/modules/product/index.ts +++ b/src/store/modules/product/index.ts @@ -8,11 +8,7 @@ import RootState from '../../RootState' const productModule: Module = { namespaced: true, state: { - cached: {}, - products: { - list: {}, - total: 0 - } + cached: {} }, getters, actions, diff --git a/src/store/modules/product/mutation-types.ts b/src/store/modules/product/mutation-types.ts index 734c80c6..efcf3edd 100644 --- a/src/store/modules/product/mutation-types.ts +++ b/src/store/modules/product/mutation-types.ts @@ -1,3 +1,2 @@ export const SN_PRODUCT = 'product' -export const PRODUCT_SEARCH_UPDATED = SN_PRODUCT + '/SEARCH_UPDATED' export const PRODUCT_ADD_TO_CACHED_MULTIPLE = SN_PRODUCT + '/ADD_TO_CACHED_MULTIPLE' diff --git a/src/store/modules/product/mutations.ts b/src/store/modules/product/mutations.ts index 9e79c6a5..e533dc7a 100644 --- a/src/store/modules/product/mutations.ts +++ b/src/store/modules/product/mutations.ts @@ -3,10 +3,6 @@ import ProductState from './ProductState' import * as types from './mutation-types' const mutations: MutationTree = { - [types.PRODUCT_SEARCH_UPDATED] (state, payload) { - state.products.list = payload.products; - state.products.total = payload.totalProductsCount; - }, [types.PRODUCT_ADD_TO_CACHED_MULTIPLE] (state, payload) { if (payload.products) { payload.products.forEach((product: any) => { diff --git a/src/views/Search.vue b/src/views/Search.vue deleted file mode 100644 index 899ec96e..00000000 --- a/src/views/Search.vue +++ /dev/null @@ -1,106 +0,0 @@ - - - - - {{ $t("Search") }} - - - - - - - {{ $t("Results") }} - - - - - - - - - - - - \ No newline at end of file
{{ product.productName }}
{{$filters.getFeature(product.featureHierarchy, '1/COLOR/')}} | {{$filters.getFeature(product.featureHierarchy, '1/SIZE/')}}