remove Method

Removes the cookie associated with the given key. Optionally, you can provide CookieParams to specify additional options, such as the path or domain, to ensure the correct cookie is removed

@param key: string
The specific key of the cookie to be removed

@param params?: CookieParams
Optional parameters that can be used to specify the cookie’s path, domain, etc.

API

remove(key: string, params?: CookieParams): void;

Example

import {cookie} from '@bitfiber/rx';
 
const now = new Date();
const ck = cookie();
 
ck.remove('key', {
  path: '/some-path',
  domain: '.example.com',
  expires: new Date(now.getTime() - 1000*60*60*24),
  maxAge: -1,
  secure: true,
  sameSite: 'strict',
});