mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-11 19:04:30 +00:00
site: mention host in preload and in page store
This commit is contained in:
@@ -23,7 +23,7 @@ It lives in a `context="module"` script — see the [tutorial](https://svelte.de
|
||||
|
||||
The `preload` function receives two arguments — `page` and `session`.
|
||||
|
||||
`page` is a `{ path, params, query }` object where `path` is the URL's pathname, `params` is derived from `path` and the route filename, and `query` is an object of values in the query string.
|
||||
`page` is a `{ host, path, params, query }` object where `host` is the URL's host, `path` is its pathname, `params` is derived from `path` and the route filename, and `query` is an object of values in the query string.
|
||||
|
||||
So if the example above was `src/routes/blog/[slug].svelte` and the URL was `/blog/some-post?foo=bar&baz`, the following would be true:
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ Inside a component, get references to the stores like so:
|
||||
```
|
||||
|
||||
* `preloading` contains a readonly boolean value, indicating whether or not a navigation is pending
|
||||
* `page` contains a readonly `{ path, params, query }` object, identical to that passed to `preload` functions
|
||||
* `page` contains a readonly `{ host, path, params, query }` object, identical to that passed to `preload` functions
|
||||
* `session` contains whatever data was seeded on the server. It is a [writable store](https://svelte.dev/tutorial/writable-stores), meaning you can update it with new data (for example, after the user logs in) and your app will be refreshed
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user