mirror of
https://github.com/vercel/commerce.git
synced 2025-06-19 21:51:21 +00:00
saleor: fix the session handling
This commit is contained in:
parent
e0ee2580bd
commit
3b559e9853
@ -18,8 +18,7 @@ const countItem = (count: number, item: LineItem) => count + item.quantity
|
||||
|
||||
const UserNav: FC<Props> = ({ className }) => {
|
||||
const { data } = useCart()
|
||||
let customer;
|
||||
// const { data: customer } = useCustomer()
|
||||
const { data: customer } = useCustomer()
|
||||
const { toggleSidebar, closeSidebarIfPresent, openModal } = useUI()
|
||||
const itemsCount = data?.lineItems.reduce(countItem, 0) ?? 0
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import useCustomer, { UseCustomer } from '@commerce/customer/use-customer'
|
||||
import { Customer } from '@commerce/types'
|
||||
import { SWRHook } from '@commerce/utils/types'
|
||||
import { getCustomerQuery, getCSRFToken } from '../utils'
|
||||
import { getCustomerQuery } from '../utils'
|
||||
|
||||
export default useCustomer as UseCustomer<typeof handler>
|
||||
|
||||
@ -12,9 +12,9 @@ export const handler: SWRHook<Customer | null> = {
|
||||
async fetcher({ options, fetch }) {
|
||||
const data = await fetch<any | null>({
|
||||
...options,
|
||||
variables: { customerAccessToken: getCSRFToken() },
|
||||
variables: {},
|
||||
})
|
||||
return data.customer ?? null
|
||||
return data.me ?? null
|
||||
},
|
||||
useHook: ({ useData }) => (input) => {
|
||||
return useData({
|
||||
|
17251
framework/saleor/schema.d.ts
vendored
17251
framework/saleor/schema.d.ts
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user