Minima.js API / @minimajs/cookie / cookies / remove
Function: remove()
ts
function remove(name, options?): void;Defined in: index.ts:184
Removes a cookie by setting its expiration to the past. The cookie is immediately removed from the incoming cookies for the current request.
Parameters
name
string
The cookie name to remove
options?
SerializeOptions
Cookie options (must match the path/domain of the original cookie)
Returns
void
Example
typescript
// Remove a cookie
cookies.remove("sessionId");
// Remove a cookie with specific path/domain
cookies.remove("adminToken", {
path: "/admin",
domain: "example.com",
});Remarks
To successfully remove a cookie, the path and domain options must match those used when the cookie was originally set. Browsers will only delete cookies that match all attributes.
Since
1.0.0