mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 05:31:22 +00:00
Fix build errors
This commit is contained in:
parent
a6cfea0d28
commit
45c0f28639
1
framework/vendure/api/cart/index.ts
Normal file
1
framework/vendure/api/cart/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export default function () {}
|
1
framework/vendure/api/catalog/index.ts
Normal file
1
framework/vendure/api/catalog/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export default function () {}
|
1
framework/vendure/api/catalog/products.ts
Normal file
1
framework/vendure/api/catalog/products.ts
Normal file
@ -0,0 +1 @@
|
||||
export default function () {}
|
1
framework/vendure/api/customers/index.ts
Normal file
1
framework/vendure/api/customers/index.ts
Normal file
@ -0,0 +1 @@
|
||||
export default function () {}
|
1
framework/vendure/api/customers/login.ts
Normal file
1
framework/vendure/api/customers/login.ts
Normal file
@ -0,0 +1 @@
|
||||
export default function () {}
|
1
framework/vendure/api/customers/logout.ts
Normal file
1
framework/vendure/api/customers/logout.ts
Normal file
@ -0,0 +1 @@
|
||||
export default function () {}
|
1
framework/vendure/api/customers/signup.ts
Normal file
1
framework/vendure/api/customers/signup.ts
Normal file
@ -0,0 +1 @@
|
||||
export default function () {}
|
2
framework/vendure/api/wishlist/index.tsx
Normal file
2
framework/vendure/api/wishlist/index.tsx
Normal file
@ -0,0 +1,2 @@
|
||||
export type WishlistItem = { product: any; id: number }
|
||||
export default function () {}
|
@ -12,21 +12,23 @@ import { signupMutation } from '../lib/mutations/sign-up-mutation'
|
||||
|
||||
export default useSignup as UseSignup<typeof handler>
|
||||
|
||||
export const handler: MutationHook<
|
||||
null,
|
||||
{},
|
||||
RegisterCustomerInput,
|
||||
RegisterCustomerInput
|
||||
> = {
|
||||
export type SignupInput = {
|
||||
email: string
|
||||
firstName: string
|
||||
lastName: string
|
||||
password: string
|
||||
}
|
||||
|
||||
export const handler: MutationHook<null, {}, SignupInput, SignupInput> = {
|
||||
fetchOptions: {
|
||||
query: signupMutation,
|
||||
},
|
||||
async fetcher({
|
||||
input: { firstName, lastName, emailAddress, password },
|
||||
input: { firstName, lastName, email, password },
|
||||
options,
|
||||
fetch,
|
||||
}) {
|
||||
if (!(firstName && lastName && emailAddress && password)) {
|
||||
if (!(firstName && lastName && email && password)) {
|
||||
throw new CommerceError({
|
||||
message:
|
||||
'A first name, last name, email and password are required to signup',
|
||||
@ -36,7 +38,7 @@ export const handler: MutationHook<
|
||||
input: {
|
||||
firstName,
|
||||
lastName,
|
||||
emailAddress,
|
||||
emailAddress: email,
|
||||
password,
|
||||
},
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ export const handler = {
|
||||
const { mutate } = useCart()
|
||||
|
||||
return useCallback(
|
||||
async function addItem(input: CartItemBody) {
|
||||
async function addItem(input: Partial<CartItemBody>) {
|
||||
const itemId = item?.id
|
||||
const productId = input.productId ?? item?.productId
|
||||
const variantId = input.productId ?? item?.variantId
|
||||
|
@ -3,6 +3,20 @@ import { GetCollectionsQuery } from '../schema'
|
||||
import { arrayToTree } from '../lib/array-to-tree'
|
||||
import { getCollectionsQuery } from '../lib/queries/get-collections-query'
|
||||
|
||||
export type Category = {
|
||||
entityId: string
|
||||
name: string
|
||||
path: string
|
||||
productCount: number
|
||||
}
|
||||
|
||||
export type GetSiteInfoResult<
|
||||
T extends { categories: any[]; brands: any[] } = {
|
||||
categories: Category[]
|
||||
brands: any[]
|
||||
}
|
||||
> = T
|
||||
|
||||
async function getSiteInfo({
|
||||
query = getCollectionsQuery,
|
||||
variables,
|
||||
@ -12,19 +26,18 @@ async function getSiteInfo({
|
||||
variables?: any
|
||||
config?: VendureConfig
|
||||
preview?: boolean
|
||||
} = {}): Promise<any> {
|
||||
} = {}): Promise<GetSiteInfoResult> {
|
||||
config = getConfig(config)
|
||||
// RecursivePartial forces the method to check for every prop in the data, which is
|
||||
// required in case there's a custom `query`
|
||||
const { data } = await config.fetch<GetCollectionsQuery>(query, { variables })
|
||||
const categories = arrayToTree(
|
||||
data.collections?.items.map((i) => ({
|
||||
const collections = data.collections?.items.map((i) => ({
|
||||
...i,
|
||||
entityId: i.id,
|
||||
path: i.slug,
|
||||
productCount: i.productVariants.totalItems,
|
||||
}))
|
||||
).children
|
||||
const categories = arrayToTree(collections).children
|
||||
const brands = [] as any[]
|
||||
|
||||
return {
|
||||
|
5
framework/vendure/types.ts
Normal file
5
framework/vendure/types.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import * as Core from '@commerce/types'
|
||||
|
||||
export interface LineItem extends Core.LineItem {
|
||||
options?: any[]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user