-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
26 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'astro': patch | ||
--- | ||
|
||
ensure session regeneration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,13 @@ | ||
// @ts-check | ||
import { defineConfig } from 'astro/config'; | ||
|
||
import node from '@astrojs/node'; | ||
|
||
// https://astro.build/config | ||
export default defineConfig({}); | ||
export default defineConfig({ | ||
experimental: { session: { driver: 'fs' } }, | ||
|
||
adapter: node({ | ||
mode: 'standalone', | ||
}), | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
--- | ||
import Welcome from '../components/Welcome.astro'; | ||
import Layout from '../layouts/Layout.astro'; | ||
export const prerender = false; | ||
// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build | ||
// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh. | ||
await Astro.session.regenerate(); | ||
const sessionId = `the current session ID is: ${Astro.cookies.get('astro-session')?.value}`; | ||
--- | ||
|
||
<Layout> | ||
<Welcome /> | ||
This page refreshes its session ID on every load. It is currently {sessionId} | ||
</Layout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,10 @@ | ||
--- | ||
import Header from '../components/Header.astro'; | ||
import Container from '../components/Container.astro'; | ||
import ProductListing from '../components/ProductListing.astro'; | ||
import { getProducts } from '../api'; | ||
import '../styles/common.css'; | ||
export const prerender = false; | ||
// Welcome to Astro! Wondering what to do next? Check out the Astro documentation at https://docs.astro.build | ||
// Don't want to use any of this? Delete everything in this file, the `assets`, `components`, and `layouts` directories, and start fresh. | ||
const products = await getProducts(Astro.request); | ||
await Astro.session.regenerate(); | ||
const sessionId = `the current session ID is: ${Astro.cookies.get('astro-session')?.value}`; | ||
--- | ||
|
||
<html lang="en"> | ||
<head> | ||
<title>Online Store</title> | ||
<style> | ||
h1 { | ||
font-size: 36px; | ||
} | ||
|
||
.product-listing-title { | ||
text-align: center; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<Header /> | ||
|
||
<Container tag="main"> | ||
<ProductListing products={products}> | ||
<h2 class="product-listing-title" slot="title">Product Listing</h2> | ||
</ProductListing> | ||
</Container> | ||
</body> | ||
</html> | ||
This page refreshes its session ID on every load. It is currently {sessionId} |