Skip to content

Commit

Permalink
docs: try ts for syntax highlight
Browse files Browse the repository at this point in the history
  • Loading branch information
atinux authored Jan 20, 2021
1 parent d61ed49 commit a6f2195
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions docs/content/en/hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ The `arguments` listed below are those your hook will receive when it's called.

- arguments: `(config)`

**Example: **
```js{}[plugins/http.js]
**Example:**

```ts [plugins/http.js]
export default function ({ $http }) {
$http.onRequest(config => {
console.log('Making request to ' + config.url)
Expand All @@ -26,8 +27,9 @@ See [here](/advanced#hooks) for advanced usage.

- arguments: `(request, options, response)`

**Example: **
```js{}[plugins/http.js]
**Example:**

```ts [plugins/http.js]
export default function ({ $http }) {
$http.onResponse((req, options, res) => {
console.log('Making request to ' + req.url)
Expand All @@ -45,8 +47,9 @@ See [here](/advanced#hooks) for advanced usage.

If the error originated from a request.

**Example: **
```js{}[plugins/http.js]
**Example:**

```ts [plugins/http.js]
export default function ({ $http, redirect }) {
$http.onError((err) => {
// In case of unauthorized, redirect to a specific page
Expand Down

0 comments on commit a6f2195

Please sign in to comment.