mirror of
https://github.com/vercel/commerce.git
synced 2025-05-17 06:56:59 +00:00
Requested changes
This commit is contained in:
parent
d1fa1c950a
commit
8203a5b21e
@ -34,7 +34,9 @@ const getLoggedInCustomer: CustomerEndpoint['handlers']['getLoggedInCustomer'] =
|
||||
getLoggedInCustomerQuery,
|
||||
undefined,
|
||||
{
|
||||
headers: {
|
||||
cookie: `${config.customerCookie}=${token}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
const { customer } = data
|
||||
|
@ -48,9 +48,9 @@ export default function getCustomerWishlistOperation({
|
||||
if (includeProducts && wishlist?.items?.length) {
|
||||
const ids = []
|
||||
|
||||
for (let i = 0; i < wishlist.items.length; i++) {
|
||||
if (wishlist.items[i].product_id) {
|
||||
ids.push(String(wishlist.items[i]?.product_id))
|
||||
for (const wishlistItem of wishlist.items) {
|
||||
if (wishlistItem.product_id) {
|
||||
ids.push(String(wishlistItem.product_id))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ import type {
|
||||
import type { LoginOperation } from '@vercel/commerce/types/login'
|
||||
import type { LoginMutation } from '../../../schema'
|
||||
import type { RecursivePartial } from '../utils/types'
|
||||
import concatHeader from '../utils/concat-cookie'
|
||||
import type { BigcommerceConfig, Provider } from '..'
|
||||
|
||||
export const loginMutation = /* GraphQL */ `
|
||||
|
@ -7,7 +7,7 @@ const fetchGraphqlApi: (getConfig: () => BigcommerceConfig) => GraphQLFetcher =
|
||||
async (
|
||||
query: string,
|
||||
{ variables, preview } = {},
|
||||
headers?: HeadersInit
|
||||
options: { headers?: HeadersInit } = {}
|
||||
): Promise<any> => {
|
||||
// log.warn(query)
|
||||
const config = getConfig()
|
||||
@ -16,7 +16,7 @@ const fetchGraphqlApi: (getConfig: () => BigcommerceConfig) => GraphQLFetcher =
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Authorization: `Bearer ${config.apiToken}`,
|
||||
...headers,
|
||||
...options.headers,
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
|
@ -20,7 +20,9 @@ async function getCustomerId({
|
||||
getCustomerIdQuery,
|
||||
undefined,
|
||||
{
|
||||
headers: {
|
||||
cookie: `${config.customerCookie}=${customerToken}`,
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -165,7 +165,9 @@ export interface CommerceAPIConfig {
|
||||
fetch<Data = any, Variables = any>(
|
||||
query: string,
|
||||
queryData?: CommerceAPIFetchOptions<Variables>,
|
||||
headers?: HeadersInit
|
||||
options?: {
|
||||
headers: HeadersInit
|
||||
}
|
||||
): Promise<GraphQLFetcherResult<Data>>
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,6 @@ export const getCustomerAddressBodySchema = z.object({
|
||||
})
|
||||
|
||||
export const customerSchema = z.object({
|
||||
customer: z.object({
|
||||
id: z.string(),
|
||||
firstName: z.string(),
|
||||
lastName: z.string(),
|
||||
@ -14,7 +13,6 @@ export const customerSchema = z.object({
|
||||
company: z.string().optional(),
|
||||
notes: z.string().optional(),
|
||||
acceptsMarketing: z.boolean().optional(),
|
||||
}),
|
||||
})
|
||||
|
||||
export const addressSchema = z.object({
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { FC, useEffect, useState, useCallback } from 'react'
|
||||
import { useEffect, useState, useCallback } from 'react'
|
||||
import { Logo, Button, Input } from '@components/ui'
|
||||
import useLogin from '@framework/auth/use-login'
|
||||
import { useUI } from '@components/ui/context'
|
||||
|
Loading…
x
Reference in New Issue
Block a user