Skip to content

Commit

Permalink
12/17 root에 렌더링
Browse files Browse the repository at this point in the history
  • Loading branch information
BoYoung00 committed Dec 17, 2024
1 parent fa36acf commit ac56a8b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ const routeHandlers = () => {
const router = () => {
let path = window.location.pathname;
const user = JSON.parse(localStorage.getItem("user") || "{}");
const root = document.getElementById("root");

if (path === "/profile" && !user.username) {
path = "/login";
Expand All @@ -40,9 +41,9 @@ const router = () => {
const route = routes[path];

if (route) {
document.body.innerHTML = route();
root.innerHTML = route();
} else {
document.body.innerHTML = ErrorPage();
root.innerHTML = ErrorPage();
}

if (path === "/login") {
Expand Down

0 comments on commit ac56a8b

Please sign in to comment.