mirror of
https://github.com/vercel/commerce.git
synced 2025-07-23 04:36:49 +00:00
Initial work, copied from the Shopify provider
This commit is contained in:
20
framework/saleor/utils/customer-token.ts
Normal file
20
framework/saleor/utils/customer-token.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import Cookies, { CookieAttributes } from 'js-cookie'
|
||||
|
||||
export const getCustomerToken = () => Cookies.get('saleorAccessToken')
|
||||
|
||||
export const setCustomerToken = (
|
||||
token: string | null,
|
||||
options?: CookieAttributes
|
||||
) => {
|
||||
if (!token) {
|
||||
Cookies.remove('saleorAccessToken')
|
||||
} else {
|
||||
Cookies.set(
|
||||
'saleorAccessToken',
|
||||
token,
|
||||
options ?? {
|
||||
expires: 60 * 60 * 24 * 30,
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user