diff --git a/docs/content/2.guide/2.features/9.server-routes.md b/docs/content/2.guide/2.features/9.server-routes.md index b0a9a98087..bb51175144 100644 --- a/docs/content/2.guide/2.features/9.server-routes.md +++ b/docs/content/2.guide/2.features/9.server-routes.md @@ -155,7 +155,7 @@ export default defineEventHandler((event) => { ```ts export default defineEventHandler((event) => { - const cookies = useCookies(event) + const cookies = parseCookies(event) return { cookies } }) ``` diff --git a/docs/content/3.api/1.composables/use-cookie.md b/docs/content/3.api/1.composables/use-cookie.md index 67a9a2dca8..43a4eff732 100644 --- a/docs/content/3.api/1.composables/use-cookie.md +++ b/docs/content/3.api/1.composables/use-cookie.md @@ -138,14 +138,14 @@ Specifies a function that returns the cookie's default value. The function can a ## Handling Cookies in API Routes -You can use `useCookie` and `setCookie` from [`h3`](https://github.com/unjs/h3) package to set cookies in server API routes. +You can use `getCookie` and `setCookie` from [`h3`](https://github.com/unjs/h3) package to set cookies in server API routes. **Example:** ```js export default defineEventHandler(event => { // Read counter cookie - let counter = useCookie(event, 'counter') || 0 + let counter = getCookie(event, 'counter') || 0 // Increase counter cookie by 1 setCookie(event, 'counter', ++counter)