mirror of
https://github.com/vercel/commerce.git
synced 2025-05-16 14:36:59 +00:00
add customer token and id to localstorage
This commit is contained in:
parent
b01b327357
commit
ad634950a8
@ -1,5 +1,4 @@
|
||||
export const API_URL = process.env.NEXT_PUBLIC_SYLIUS_API_URL
|
||||
//export const API_CHANNEL = process.env.NEXT_PUBLIC_SALEOR_CHANNEL
|
||||
//export const CHECKOUT_ID_COOKIE = 'saleor.CheckoutID'
|
||||
//export const SALEOR_TOKEN = 'saleor.Token'
|
||||
//export const SALEOR_CRSF_TOKEN = 'saleor.CSRFToken'
|
||||
|
||||
export const SYLIUS_CUSTOMER_TOKEN = 'sylius_customerToken'
|
||||
export const SYLIUS_CUSTOMER_ID = 'sylius_customerId'
|
||||
|
11
packages/sylius/src/utils/token/customer-id.ts
Normal file
11
packages/sylius/src/utils/token/customer-id.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { SYLIUS_CUSTOMER_ID } from '../../const'
|
||||
|
||||
export const getCustomerId = () => localStorage.getItem(SYLIUS_CUSTOMER_ID)
|
||||
|
||||
export const setCustomerId = (id: string | null) => {
|
||||
if (!id) {
|
||||
localStorage.removeItem(SYLIUS_CUSTOMER_ID)
|
||||
} else {
|
||||
localStorage.setItem(SYLIUS_CUSTOMER_ID, id)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user