From 9402062a5ade659cda1e48127888431d8a261908 Mon Sep 17 00:00:00 2001 From: Greg Hoskin Date: Fri, 11 Jun 2021 09:37:45 -0700 Subject: [PATCH] cleanup --- .../api/operations/get-all-collections.ts | 28 ---------------- framework/swell/cart/utils/fetcher.ts | 33 ------------------- 2 files changed, 61 deletions(-) delete mode 100644 framework/swell/api/operations/get-all-collections.ts delete mode 100644 framework/swell/cart/utils/fetcher.ts diff --git a/framework/swell/api/operations/get-all-collections.ts b/framework/swell/api/operations/get-all-collections.ts deleted file mode 100644 index e150ef749..000000000 --- a/framework/swell/api/operations/get-all-collections.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { CollectionEdge } from '../../schema' -import { getConfig, SwellConfig } from '..' - -const getAllCollections = async (options?: { - variables?: any - config: SwellConfig - preview?: boolean -}) => { - let { config, variables = { limit: 25 } } = options ?? {} - config = getConfig(config) - - const response = await config.fetch('categories', 'list', { variables }) - const edges = response.results ?? [] - - const categories = edges.map( - ({ node: { id: entityId, title: name, handle } }: CollectionEdge) => ({ - entityId, - name, - path: `/${handle}`, - }) - ) - - return { - categories, - } -} - -export default getAllCollections diff --git a/framework/swell/cart/utils/fetcher.ts b/framework/swell/cart/utils/fetcher.ts deleted file mode 100644 index 2e7ae15d3..000000000 --- a/framework/swell/cart/utils/fetcher.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { HookFetcherFn } from '@commerce/utils/types' -import { Cart } from '@commerce/types' -// import { checkoutCreate, checkoutToCart } from '.' -import { FetchCartInput } from '@commerce/cart/use-cart' -import { data } from 'autoprefixer' -import { normalizeCart } from '../../utils' - -const fetcher: HookFetcherFn = async ({ - options, - // input: { cartId: checkoutId }, - fetch, -}) => { - let checkout - - // if (checkoutId) { - const data = await fetch({ - query: 'cart', - method: 'get', - // variables: { category: categoryId }, - }) - // checkout = data.node - // } - - // if (checkout?.completedAt || !checkoutId) { - // checkout = await checkoutCreate(fetch) - // } - - // TODO: Fix this type - // return checkoutToCart({ checkout } as any) - return normalizeCart(data) -} - -export default fetcher