Skip to content

Commit ad4f20b

Browse files
Made more generic solution to ignore left/right arrows on invalid pages
1 parent 0ed28de commit ad4f20b

File tree

1 file changed

+7
-3
lines changed
  • EssentialCSharp.Web/wwwroot/js

1 file changed

+7
-3
lines changed

EssentialCSharp.Web/wwwroot/js/site.js

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

154154
function goToPrevious() {
155-
if (!window.location.href.endsWith("/home")) {
156-
window.location.href = "/" + PREVIOUS_PAGE;
155+
let previousPage = PREVIOUS_PAGE;
156+
if (previousPage !== null) {
157+
window.location.href = "/" + previousPage;
157158
}
158159
}
159160
function goToNext() {
160-
window.location.href = "/" + NEXT_PAGE;
161+
let nextPage = NEXT_PAGE;
162+
if (nextPage !== null) {
163+
window.location.href = "/" + nextPage;
164+
}
161165
}
162166

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

0 commit comments

Comments
 (0)