Skip to content

Commit

Permalink
history doesn't exist in SSR, so don't call
Browse files Browse the repository at this point in the history
Redirects with too many path parts where breaking, now they take
users to broken parts of the old Oengus when redirecting
  • Loading branch information
BobChao87 committed Sep 23, 2021
1 parent 3ca4f32 commit c50c4d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion middleware/oengus-v1-redirect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const oengusV1Redirect: Middleware = function ({ $config, route, redirect, from
// If you hit back, you get the page BEFORE the page you clicked the link on.
// This makes sure we push an entry to the history stack to go back to.
// If we start having doubled up history, this history.pushState is a good candidate to check.
history.pushState((Number.parseFloat(history.state) + 1).toFixed(3), document.title, from.fullPath);
globalThis.history?.pushState((Number.parseFloat(history.state) + 1).toFixed(3), document.title, from.fullPath);
redirect(`https://${$config.env.DOMAIN_V1}/${to.join('/')}`);
}
};
Expand Down

0 comments on commit c50c4d4

Please sign in to comment.