chore: release 1.4.0 (#1639)

This commit is contained in:
Marvin Hagemeister
2023-08-16 17:35:29 +02:00
committed by GitHub
parent 1e45dd4587
commit c175e28bf3
8 changed files with 101 additions and 319 deletions
+6 -3
View File
@@ -13,7 +13,9 @@ used to trigger child handlers. The `ctx` also has a `state` property that can
be used to pass arbitrary data to downstream (or upstream) handlers. This
`state` is included in `PageProps` by default, which is available to both the
special [\_app](/docs/concepts/app-wrapper.md) wrapper and normal
[routes](/docs/concepts/routes.md).
[routes](/docs/concepts/routes.md). `ctx.state` is normally set by modifying its
properties, e.g. `ctx.state.loggedIn = true`, but you can also replace the
entire object like `ctx.state = { loggedIn = true }`.
```ts routes/_middleware.ts
import { MiddlewareHandlerContext } from "$fresh/server.ts";
@@ -207,11 +209,12 @@ export function handler(req: Request): Response {
`307` stands for temporary redirect. You can also use `301` for permanent
redirect. You can also redirect to a relative path by doing:
```ts
````ts
export function handler(req: Request): Response {
return new Response("", {
status: 307,
headers: { Location: "/my/new/relative/path" },
});
}
```
```****
````