Skip to content

Commit

Permalink
Merge pull request #26 from vuestorefront-community/dev
Browse files Browse the repository at this point in the history
chore: release version 1.2.1
  • Loading branch information
odranoelBR authored Mar 5, 2022
2 parents ad6053c + 41ac071 commit f32e4fa
Show file tree
Hide file tree
Showing 13 changed files with 812 additions and 455 deletions.
6 changes: 4 additions & 2 deletions packages/api-client/src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,8 @@ export type GraphQlGetProductParams = {
export type ParamsFromUrlFilterInput = {
categoryId?: number;
attributeValueId: number[];
minPrice: string;
maxPrice: string;
};

export type ParamsFromUrl = {
Expand All @@ -558,13 +560,13 @@ export interface AgnosticFacetSearchParams {
term?: string;
page?: number;
itemsPerPage?: number;
sort?: string;
sort?: string | string[];
filters?: Record<string, string[]>;
metadata?: any;
[x: string]: any;
}
export interface SearchResultParams<S> {
data: S;
data?: S;
input: AgnosticFacetSearchParams;
}

7 changes: 5 additions & 2 deletions packages/composables/src/composables/useFacet/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { FacetResultsData } from '../types';
const factoryParams = {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
search: async (context: Context, params: SearchResultParams<ParamsFromUrl>): Promise<FacetResultsData> => {

const { customQueryProducts, customQueryCategories } = params.input;
const categoryParams: GraphQlGetCategoryParams = {
pageSize: 100,
Expand All @@ -14,12 +15,14 @@ const factoryParams = {

const productParams: GraphQlGetProductParams = {
pageSize: params.input.pageSize,
currentPage: params.input.currentPage,
currentPage: parseInt(params.input.currentPage),
search: params.input.search,
sort: params.input.sort as ProductSortInput,
filter: {
categoryId: params?.input?.filter?.categoryId,
attributeValueId: params.input?.filter?.attributeValueId?.map(id => parseInt(id))
attributeValueId: params.input?.filter?.attributeValueId?.map(id => parseInt(id)),
minPrice: parseInt(params?.input?.minPrice),
maxPrice: parseInt(params?.input?.maxPrice)
}
};

Expand Down
13 changes: 3 additions & 10 deletions packages/composables/src/composables/useNewsLetter/index.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import {
Context, Logger
} from '@vue-storefront/core';
import useUser from '../useUser';
import { Context, Logger} from '@vue-storefront/core';
import { useNewsletterFactory, UseNewsletterFactoryParams } from '../../factories/useNewsLetterFactory';

const factoryParams: UseNewsletterFactoryParams<any, string> = {
provide() {
return {
user: useUser()
};
},

sendSubscription: async (context: Context, params) => {
Logger.debug('[Magento]: Update user newsletter subscription', { params });
Logger.debug('[Odoo]: Update user newsletter subscription', { params });

const { data } = await context.$odoo.api.subscribeNewsLetter(
{
Expand Down
1 change: 0 additions & 1 deletion packages/composables/src/factories/useNewsLetterFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ export const useNewsletterFactory = <NEWSLETTER, SEND_NEWSLETTER_PARAMS, API ext
try {
loading.value = true;
error.value.sendSubscription = null;
console.log(await _factoryParams.sendSubscription(params));

return await _factoryParams.sendSubscription(params);
} catch (err) {
Expand Down
Loading

0 comments on commit f32e4fa

Please sign in to comment.