bc-node-sdk
Version:
BetterCommerce's NodeJS SDK encapsulates the base framework for all the Next.js applications.
34 lines (33 loc) • 1.09 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// Package Imports
const js_cookie_1 = __importDefault(require("js-cookie"));
class CookieUtil {
/**
* Sets a cookie with the given key and data
* @param key - The key of the cookie
* @param data - The data to be stored in the cookie
*/
static setCookie(key, data) {
js_cookie_1.default.set(key, data);
}
/**
* Retrieves the value of a cookie with the given key
* @param key - The key of the cookie
* @returns The value of the cookie, or undefined if it does not exist
*/
static getCookie(key) {
return js_cookie_1.default.get(key);
}
/**
* Removes the cookie with the given key
* @param key - The key of the cookie to be removed
*/
static removeCookie(key) {
js_cookie_1.default.remove(key);
}
}
exports.default = CookieUtil;