mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 13:22:14 +00:00
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.
14 lines
513 B
TypeScript
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);
|
|
}
|