From b9754ab8e15b304a64677dc0664e310b58805016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=A5=EC=9B=90=EC=A0=95?= Date: Mon, 16 Dec 2024 14:27:12 +0900 Subject: [PATCH] =?UTF-8?q?refacotr:=20updateContent=20=ED=95=A8=EC=88=98?= =?UTF-8?q?=20=EC=82=AD=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main.js b/src/main.js index ecbda072..b4a517f1 100644 --- a/src/main.js +++ b/src/main.js @@ -53,10 +53,6 @@ const hashRoutes = { const router = createRouter(routes); -function updateContent() { - router(); -} - function submitEventHandler(e) { e.preventDefault(); const form = e.target; @@ -79,7 +75,6 @@ function submitEventHandler(e) { new UserStore().setUser({ username, email, bio }); router("/profile"); - updateContent(); } } @@ -98,6 +93,6 @@ function clickEventHandler(e) { } } -window.addEventListener("popstate", updateContent); -window.addEventListener("load", updateContent); -window.addEventListener("hashchange", updateContent); +window.addEventListener("popstate", () => router()); +window.addEventListener("load", () => router()); +window.addEventListener("hashchange", () => router());