Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

Commit

Permalink
docs(navigate-to): use await instead of return (#7734)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheDutchCoder committed Sep 22, 2022
1 parent dffec69 commit f4f6ed4
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions docs/content/3.api/3.utils/navigate-to.md
Expand Up @@ -71,13 +71,13 @@ An object accepting the following properties:
```vue
<script setup>
// passing 'to' as a string
return navigateTo('/search')
await navigateTo('/search')
// ... or as a route object
return navigateTo({ path: '/search' })
await navigateTo({ path: '/search' })
// ... or as a route object with query parameters
return navigateTo({
await navigateTo({
path: '/search',
query: {
page: 1,
Expand All @@ -103,13 +103,13 @@ export default defineNuxtRouteMiddleware((to, from) => {

```vue
<script setup>
// will throw an error;
// navigating to an external URL is not allowed by default
await navigateTo('https://v3.nuxtjs.org')
// will redirect successfully with the 'external' parameter set to 'true'
await navigateTo('https://v3.nuxtjs.org', {
external: true
})
// will throw an error;
// navigating to an external URL is not allowed by default
await navigateTo('https://v3.nuxtjs.org')
// will redirect successfully with the 'external' parameter set to 'true'
await navigateTo('https://v3.nuxtjs.org', {
external: true
})
</script>
```

0 comments on commit f4f6ed4

Please sign in to comment.