Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
23 lines
713 B
Plaintext
23 lines
713 B
Plaintext
import createSharedNavigationFns from '../shared/createSharedNavigationFns.js';
|
|
import getServerLocale from './getServerLocale.js';
|
|
|
|
function createNavigation(routing) {
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
const {
|
|
config,
|
|
...fns
|
|
} = createSharedNavigationFns(getServerLocale, routing);
|
|
function notSupported(hookName) {
|
|
return () => {
|
|
throw new Error(`\`${hookName}\` is not supported in Server Components. You can use this hook if you convert the calling component to a Client Component.`);
|
|
};
|
|
}
|
|
return {
|
|
...fns,
|
|
usePathname: notSupported('usePathname'),
|
|
useRouter: notSupported('useRouter')
|
|
};
|
|
}
|
|
|
|
export { createNavigation as default };
|