Files
HealthLog/src/lib/navigation/load-document.ts
T
Marc-André Bombeck 48bfc1f987 refactor(navigation): name the full-document loads the client router cannot serve
Nine places assigned window.location.href directly: OAuth connects and
sign-in hand-offs that land on API routes answering with a redirect, and
the reload after account deletion. The newer Next lint rule reads each as
an in-app page change. They now go through one helper that says why a
document load is the right tool there.
2026-09-24 10:37:21 +02:00

14 lines
513 B
TypeScript

/**
* Leave the client router and load `path` as a new document.
*
* For destinations the client router cannot serve: an API route that answers
* with a redirect (an OAuth connect, a sign-in hand-off), or a page that has
* to start from a fresh document because the client state of the old one no
* longer belongs to anybody (after the account was deleted).
*
* In-app page changes use `useRouter().push()` instead.
*/
export function loadDocument(path: string): void {
window.location.assign(path);
}