diff options
author | 2022-09-29 08:20:00 -0700 | |
---|---|---|
committer | 2022-09-29 11:20:00 -0400 | |
commit | d08093f7d4f9762c0edc71e14c796d7ea8038cda (patch) | |
tree | fae95330db4aeaf16841e16bd24c24e61c11c107 /packages/integrations/node/CHANGELOG.md | |
parent | 10317c65feefd34a2b4b6142a4bdd1f1cc19f58e (diff) | |
download | astro-d08093f7d4f9762c0edc71e14c796d7ea8038cda.tar.gz astro-d08093f7d4f9762c0edc71e14c796d7ea8038cda.tar.zst astro-d08093f7d4f9762c0edc71e14c796d7ea8038cda.zip |
[ci] release (#4903)astro@1.4.0@astrojs/vue@1.1.0@astrojs/vercel@2.1.0@astrojs/telemetry@1.0.1@astrojs/tailwind@2.0.2@astrojs/svelte@1.0.1@astrojs/rss@1.0.2@astrojs/preact@1.1.1@astrojs/node@1.1.0@astrojs/netlify@1.1.0@astrojs/mdx@0.11.3@astrojs/markdown-remark@1.1.3@astrojs/image@0.8.1@astrojs/deno@1.1.0@astrojs/cloudflare@2.1.0
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'packages/integrations/node/CHANGELOG.md')
-rw-r--r-- | packages/integrations/node/CHANGELOG.md | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/packages/integrations/node/CHANGELOG.md b/packages/integrations/node/CHANGELOG.md index fadb07533..045b370e7 100644 --- a/packages/integrations/node/CHANGELOG.md +++ b/packages/integrations/node/CHANGELOG.md @@ -1,5 +1,54 @@ # @astrojs/node +## 1.1.0 + +### Minor Changes + +- [#4876](https://github.com/withastro/astro/pull/4876) [`d3091f89e`](https://github.com/withastro/astro/commit/d3091f89e92fcfe1ad48daca74055d54b1c853a3) Thanks [@matthewp](https://github.com/matthewp)! - Adds the Astro.cookies API + + `Astro.cookies` is a new API for manipulating cookies in Astro components and API routes. + + In Astro components, the new `Astro.cookies` object is a map-like object that allows you to get, set, delete, and check for a cookie's existence (`has`): + + ```astro + --- + type Prefs = { + darkMode: boolean; + }; + + Astro.cookies.set<Prefs>( + 'prefs', + { darkMode: true }, + { + expires: '1 month', + } + ); + + const prefs = Astro.cookies.get<Prefs>('prefs').json(); + --- + + <body data-theme={prefs.darkMode ? 'dark' : 'light'}></body> + ``` + + Once you've set a cookie with Astro.cookies it will automatically be included in the outgoing response. + + This API is also available with the same functionality in API routes: + + ```js + export function post({ cookies }) { + cookies.set('loggedIn', false); + + return new Response(null, { + status: 302, + headers: { + Location: '/login', + }, + }); + } + ``` + + See [the RFC](https://github.com/withastro/rfcs/blob/main/proposals/0025-cookie-management.md) to learn more. + ## 1.0.1 ### Patch Changes |