forked from crowetic/commerce
Updates
This commit is contained in:
parent
f242f3c588
commit
e6792d6dd0
@ -15,8 +15,6 @@ import { setCustomerToken } from '@framework/utils'
|
||||
export default useLogin as UseLogin<typeof handler>
|
||||
|
||||
const getErrorMessage = ({ code, message }: CustomerUserError) => {
|
||||
console.log(code)
|
||||
|
||||
switch (code) {
|
||||
case 'UNIDENTIFIED_CUSTOMER':
|
||||
message = 'Cannot find an account that matches the provided credentials'
|
||||
|
@ -25,14 +25,12 @@ const getAllPages = async (options?: {
|
||||
}): Promise<ReturnType> => {
|
||||
let { config, variables = { first: 250 } } = options ?? {}
|
||||
config = getConfig(config)
|
||||
|
||||
const { data } = await config.fetch(getAllPagesQuery, { variables })
|
||||
const edges = data.pages?.edges
|
||||
|
||||
const pages = edges?.map(
|
||||
({ node: { title: name, handle: url, ...node } }: PageEdge) => ({
|
||||
const pages = data.pages?.edges?.map(
|
||||
({ node: { title: name, handle, ...node } }: PageEdge) => ({
|
||||
...node,
|
||||
url,
|
||||
url: `/${handle}`,
|
||||
name,
|
||||
})
|
||||
)
|
||||
|
@ -22,7 +22,7 @@ const getPage = async (options: {
|
||||
variables,
|
||||
})
|
||||
|
||||
const page = data.pageByHandle
|
||||
const { pageByHandle: page } = data
|
||||
|
||||
return {
|
||||
page: page
|
||||
|
@ -8,4 +8,7 @@ module.exports = {
|
||||
images: {
|
||||
domains: ['cdn.shopify.com'],
|
||||
},
|
||||
typescript: {
|
||||
ignoreBuildErrors: true,
|
||||
},
|
||||
}
|
||||
|
@ -1,10 +1,6 @@
|
||||
import { GraphQLFetcherResult } from '@commerce/api'
|
||||
import { getConfig, ShopifyConfig } from '../api'
|
||||
import { Product } from '../schema'
|
||||
import getProductQuery from '../utils/queries/get-product-query'
|
||||
import { normalizeProduct } from '@framework/utils/normalize'
|
||||
|
||||
export type ProductNode = Product
|
||||
import { normalizeProduct, getProductQuery } from '../utils'
|
||||
|
||||
type Variables = {
|
||||
slug: string
|
||||
|
@ -41,7 +41,6 @@ const normalizeProductImages = ({ edges }: ImageConnection) =>
|
||||
}))
|
||||
|
||||
const normalizeProductVariants = ({ edges }: ProductVariantConnection) => {
|
||||
console.log(edges)
|
||||
return edges?.map(({ node: { id, selectedOptions } }) => ({
|
||||
id,
|
||||
options: selectedOptions.map(({ name, value }: SelectedOption) =>
|
||||
|
@ -1,5 +1,5 @@
|
||||
export const getAllPagesQuery = /* GraphQL */ `
|
||||
query($first: Int!) {
|
||||
query getAllPages($first: Int = 250) {
|
||||
pages(first: $first) {
|
||||
edges {
|
||||
node {
|
||||
|
@ -1,5 +1,5 @@
|
||||
const getAllProductsPathsQuery = /* GraphQL */ `
|
||||
query getAllProductPaths($first: Int!, $cursor: String) {
|
||||
query getAllProductPaths($first: Int = 250, $cursor: String) {
|
||||
products(first: $first, after: $cursor) {
|
||||
pageInfo {
|
||||
hasNextPage
|
||||
|
@ -1,15 +1,12 @@
|
||||
export const getPageQuery = /* GraphQL */ `
|
||||
query($first: Int!) {
|
||||
pages(first: $first) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
title
|
||||
handle
|
||||
body
|
||||
url
|
||||
}
|
||||
}
|
||||
query getPageBySlug($slug: String!) {
|
||||
pageByHandle(handle: $slug) {
|
||||
id
|
||||
title
|
||||
handle
|
||||
body
|
||||
bodySummary
|
||||
url
|
||||
}
|
||||
}
|
||||
`
|
||||
|
@ -1,5 +1,5 @@
|
||||
export { default as getSiteCollectionsQuery } from './get-all-collections-query'
|
||||
export { default as getProductQuery } from './get-all-products-paths-query'
|
||||
export { default as getProductQuery } from './get-product-query'
|
||||
export { default as getAllProductsQuery } from './get-all-products-query'
|
||||
export { default as getAllProductsPathtsQuery } from './get-all-products-paths-query'
|
||||
export { default as getAllProductVendors } from './get-all-product-vendors-query'
|
||||
|
Loading…
x
Reference in New Issue
Block a user