feat: get all collection

:%s
This commit is contained in:
lytrankieio123
2021-10-05 10:30:39 +07:00
parent a8955000a5
commit 1546d5df4b
17 changed files with 230 additions and 38 deletions

View File

@@ -1,6 +1,7 @@
import { Facet } from "@commerce/types/facet";
import { FacetValue } from './../../framework/vendure/schema.d';
import { CODE_FACET_DISCOUNT, CODE_FACET_FEATURED, CODE_FACET_FEATURED_VARIANT } from "./constanst.utils";
import { PromiseWithKey } from "./types.utils";
export function isMobile() {
return window.innerWidth < 768
@@ -55,4 +56,8 @@ export function getFacetNamesFromIds(facets: FacetValue[], ids?: string[]): stri
const facetItems = facets.filter((item: FacetValue) => ids.includes(item.id))
const names = facetItems.map((item: FacetValue) => item.name)
return names.join(", ")
}
}
export function getAllPromies (promies: PromiseWithKey[]) {
return promies.map(item => item.promise)
}

View File

@@ -50,4 +50,10 @@ export type filterContextType = {
visible: boolean;
open: () => void;
close: () => void;
};
};
export type PromiseWithKey = {
key: string
promise: PromiseLike<any>
keyResult?: string,
}