saleor: fix the session handling

This commit is contained in:
Zaiste
2021-05-12 11:40:35 +02:00
parent e0ee2580bd
commit 3b559e9853
4 changed files with 21932 additions and 23763 deletions

View File

@@ -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({