mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-01-23 12:52:20 +01:00
24 lines
455 B
TypeScript
24 lines
455 B
TypeScript
|
import Cookies from 'js-cookie';
|
||
|
|
||
|
export const cartCookieName = 'fablab_cart_token';
|
||
|
export const cartCookieExpire = 7;
|
||
|
|
||
|
export const getCartToken = () =>
|
||
|
Cookies.get(cartCookieName);
|
||
|
|
||
|
export const setCartToken = (cartToken: string) => {
|
||
|
const cookieOptions = {
|
||
|
expires: cartCookieExpire
|
||
|
};
|
||
|
|
||
|
Cookies.set(
|
||
|
cartCookieName,
|
||
|
cartToken,
|
||
|
cookieOptions
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export const removeCartToken = () => {
|
||
|
Cookies.remove(cartCookieName);
|
||
|
};
|