From ae39a821b5c926698b090b1843eea4edae7d61dc Mon Sep 17 00:00:00 2001 From: Qin Guan Date: Mon, 22 Aug 2022 16:49:27 +0800 Subject: [PATCH] docs: use updated h3 utils (#6818) --- docs/content/2.guide/2.features/9.server-routes.md | 2 +- docs/content/3.api/1.composables/use-cookie.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) 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)