Skip to content

Commit 8a47bea

Browse files
fix: Going to previous page with left arrow at /home does not take you to /null (#604)
## Description site.js event watching for left arrow key now does nothing when the url ends with '/home'. Fixes IntelliTect-dev/EssentialCSharp.Tooling#797
1 parent b0521ca commit 8a47bea

File tree

1 file changed

+8
-2
lines changed
  • EssentialCSharp.Web/wwwroot/js

1 file changed

+8
-2
lines changed

EssentialCSharp.Web/wwwroot/js/site.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,16 @@ const app = createApp({
152152
}
153153

154154
function goToPrevious() {
155-
window.location.href = "/" + PREVIOUS_PAGE;
155+
let previousPage = PREVIOUS_PAGE;
156+
if (previousPage !== null) {
157+
window.location.href = "/" + previousPage;
158+
}
156159
}
157160
function goToNext() {
158-
window.location.href = "/" + NEXT_PAGE;
161+
let nextPage = NEXT_PAGE;
162+
if (nextPage !== null) {
163+
window.location.href = "/" + nextPage;
164+
}
159165
}
160166

161167
document.addEventListener("keydown", (e) => {

0 commit comments

Comments
 (0)