Skip to content

Commit

Permalink
backup: 워크스테이션 이전 준비
Browse files Browse the repository at this point in the history
  • Loading branch information
CreatyJohnKwon committed Dec 18, 2024
1 parent ade2f28 commit 6595124
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,10 @@ function loginPageEventController() {

function navbarEventController() {
const navbar = document.querySelector("nav");

if (navbar) {
navbar.addEventListener("click", (e) => {
if (e.target.tagName === "A") {
e.preventDefault(); // 기본 링크 클릭 동작을 막음
e.preventDefault();
const path = e.target.getAttribute("href");
router.navigateTo(path);
}
Expand Down
4 changes: 3 additions & 1 deletion src/utils/route.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export class HistoryRouter {
}

navigateTo(path) {
if (event && event.isPropagationStopped?.()) {
return;
}
history.pushState(null, "", path);
this.handleRoute(path);
}
Expand All @@ -32,7 +35,6 @@ export class HashRouter {
constructor() {
this.routes = {};
window.addEventListener("hashchange", this.handleHashChange.bind(this));
this.handleHashChange(); // 처음 세팅 된
}

// 라우트 등록
Expand Down

0 comments on commit 6595124

Please sign in to comment.