Skip to content

Commit

Permalink
fix: update examples to use the new API of cookies (#7899)
Browse files Browse the repository at this point in the history
  • Loading branch information
ematipico committed Aug 1, 2023
1 parent 9461378 commit 77ab4bb
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/ssr/src/pages/cart.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Header from '../components/Header.astro';
import Container from '../components/Container.astro';
import { getCart } from '../api';
if (!Astro.cookies.get('user-id').value) {
if (!Astro.cookies.get('user-id')) {
return Astro.redirect('/');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
const mode = Astro.cookies.get('prefs').json().mode;
const mode = Astro.cookies.get('prefs')!.json().mode;
Astro.cookies.set('prefs', {
mode: mode === 'light' ? 'dark' : 'light'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
const cookie = Astro.cookies.get('prefs');
const cookie = Astro.cookies.get('prefs')!;
const prefs = cookie.json();
---
<html>
Expand Down

0 comments on commit 77ab4bb

Please sign in to comment.