Skip to content

Commit 1ff5003

Browse files
committed
docs: Return getPathname where relevant
1 parent 140ef46 commit 1ff5003

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

docs/src/pages/docs/getting-started/app-router/with-i18n-routing.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ export const routing = defineRouting({
119119

120120
// Lightweight wrappers around Next.js' navigation APIs
121121
// that will consider the routing configuration
122-
export const {Link, redirect, usePathname, useRouter} =
122+
export const {Link, redirect, usePathname, useRouter, getPathname} =
123123
createNavigation(routing);
124124
```
125125

docs/src/pages/docs/routing/navigation.mdx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import {defineRouting} from 'next-intl/routing';
1818

1919
export const routing = defineRouting(/* ... */);
2020

21-
export const {Link, redirect, usePathname, useRouter} =
21+
export const {Link, redirect, usePathname, useRouter, getPathname} =
2222
createNavigation(routing);
2323
```
2424

@@ -32,10 +32,11 @@ In case you're building an app where locales can be added and removed at runtime
3232
```tsx filename="routing.ts"
3333
import {createNavigation} from 'next-intl/navigation';
3434

35-
export const {Link, redirect, usePathname, useRouter} = createNavigation({
36-
// ... potentially other routing
37-
// config, but no `locales` ...
38-
});
35+
export const {Link, redirect, usePathname, useRouter, getPathname} =
36+
createNavigation({
37+
// ... potentially other routing
38+
// config, but no `locales` ...
39+
});
3940
```
4041

4142
Note however that the `locales` argument for the middleware is still mandatory. If you need to fetch the available locales at runtime, you can provide the routing configuration for the middleware [dynamically per request](/docs/routing/middleware#composing-other-middlewares).
@@ -324,7 +325,7 @@ function UserProfile({userId}: {userId?: string}) {
324325
To work around this limitation, you can add an explicit type annotation to the `redirect` function:
325326

326327
```tsx filename="routing.ts"
327-
const {redirect: _redirect} = createNavigation(routing);
328+
const {/* ..., */ redirect: _redirect} = createNavigation(routing);
328329

329330
// Enable type narrowing after calling `redirect`
330331
export const redirect: typeof _redirect = _redirect;

0 commit comments

Comments
 (0)