is there any way to delete all cookies with one command #58758
-
Summaryfor delete cookies in next.js 14 i'm using this code import { cookies } from 'next/headers' async function create(data) { is there any better way to delete all cookies with on command? Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
🤔 maybe? cookieStore.getAll().forEach((cookie) => {
cookieStore.delete(cookie.name);
}); |
Beta Was this translation helpful? Give feedback.
-
const cookieStore = cookies();
// clear the session cookie
cookieStore.getAll().forEach((cookie) => {
cookieStore.delete(cookie.name);
}); |
Beta Was this translation helpful? Give feedback.
-
In the cookies docs You can clearly see that there is a |
Beta Was this translation helpful? Give feedback.
🤔 maybe?