mirror of
https://github.com/vercel/commerce.git
synced 2025-07-29 05:01:22 +00:00
.vscode
assets
components
config
framework
bigcommerce
commerce
commercejs
commercelayer
api
endpoints
operations
utils
cookies.ts
fetch-local.ts
fetch.ts
getCredentials.ts
normalizeLineItems.tsx
index.ts
auth
cart
customer
product
utils
wishlist
.env.template
README.md
commerce.config.json
const.ts
data.json
fetcher.ts
index.tsx
next.config.js
provider.ts
kibocommerce
local
ordercloud
saleor
shopify
spree
swell
vendure
lib
pages
public
.editorconfig
.env.template
.eslintrc
.gitignore
.prettierignore
.prettierrc
README.md
codegen.bigcommerce.json
codegen.json
commerce.config.json
global.d.ts
license.md
next-env.d.ts
next.config.js
package-lock.json
package.json
postcss.config.js
swell-js.d.ts
tailwind.config.js
tsconfig.json
18 lines
349 B
TypeScript
18 lines
349 B
TypeScript
import Cookies, { CookieAttributes } from 'js-cookie'
|
|
|
|
export const getCookie = (name: string): string | undefined => Cookies.get(name)
|
|
|
|
const setCookie = (
|
|
name: string,
|
|
token?: string,
|
|
options?: CookieAttributes
|
|
) => {
|
|
if (!token) {
|
|
Cookies.remove(name)
|
|
} else {
|
|
Cookies.set(name, token, options)
|
|
}
|
|
}
|
|
|
|
export default setCookie
|