mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
24 lines
590 B
JavaScript
24 lines
590 B
JavaScript
import { useRouter } from 'next/router'
|
|
|
|
if (typeof window !== 'undefined') {
|
|
window.caughtWarns = []
|
|
const origWarn = window.console.warn
|
|
const origError = window.console.error
|
|
window.console.warn = function (...args) {
|
|
window.caughtWarns.push(args)
|
|
origWarn(...args)
|
|
}
|
|
window.console.error = function (...args) {
|
|
window.caughtWarns.push(args)
|
|
origError(...args)
|
|
}
|
|
window.pathnames = []
|
|
}
|
|
|
|
export default function Page() {
|
|
if (typeof window !== 'undefined') {
|
|
window.pathnames.push(window.location.pathname)
|
|
}
|
|
return <p>{useRouter().asPath}</p>
|
|
}
|