A lightweight browser cookie for frontend applications
npm install @dbpkgs/cookie
or
yarn add @dbpkgs/cookie
import cookie from '@dbpkgs/cookie';
cookie.set('COOKIE_NAME', 'COOKIE_VALUE', options);
//options are optional, check below for acceptable options
{
expires?: Date
path?: string
domain?: string
secure?: boolean
}
import cookie from '@dbpkgs/cookie';
cookie.get('COOKIE_NAME');
import cookie from '@dbpkgs/cookie';
cookie.remove('COOKIE_NAME');
import cookie from '@dbpkgs/cookie';
cookie.set('session', 'Uxc70_67gGuHHvAmTy10a', {
expires: new Date(2022, 03, 13),
path: '',
secure: true,
});