Skip to content

Commit

Permalink
i18n(zh-cn): Update api-reference.mdx (#8386)
Browse files Browse the repository at this point in the history
  • Loading branch information
huyikai committed May 24, 2024
1 parent 5be0f30 commit efc14b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/content/docs/zh-cn/reference/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -373,10 +373,12 @@ cookie 的原始字符串值。

### `Astro.redirect()`

`Astro.redirect()` 允许你重定向到另一个页面
允许你重定向到另一个页面,并可选地提供一个 [HTTP 响应状态码](https://developer.mozilla.org/zh-CN/docs/Web/HTTP/Status) 作为第二个参数

页面(而不是子组件)必须 `return` `Astro.redirect()` 的结果,以便重定向发生。

以下示例将用户重定向到登录页面,使用默认的 HTTP 响应状态码 302:

```astro title="src/pages/account.astro" {8}
---
import { isLoggedIn } from '../utils';
Expand Down

0 comments on commit efc14b1

Please sign in to comment.