Skip to content

Commit 6c15d0d

Browse files
committed
fix: 라우팅되는 곳 변경
1 parent 5359d40 commit 6c15d0d

5 files changed

Lines changed: 8 additions & 5 deletions

File tree

cart-modal.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<div class="max-w-md mx-auto px-4 py-4">
2929
<div class="flex items-center justify-between">
3030
<h1 class="text-xl font-bold text-gray-900">
31-
<a href="/" data-link="">쇼핑몰</a>
31+
<a href="${router.BASE_PATH}" data-link="">쇼핑몰</a>
3232
</h1>
3333
<div class="flex items-center space-x-2">
3434
<!-- 장바구니 아이콘 -->

src/controllers/HomePageController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class HomePageController {
4848
if (this.state.category2) params.set("category2", this.state.category2);
4949

5050
const qs = params.toString();
51-
const newUrl = qs ? `/?${qs}` : "/";
51+
const newUrl = qs ? `${router.BASE_PATH}/?${qs}` : router.BASE_PATH;
5252
let method = replace ? "replaceState" : "pushState";
5353
// limit 가 기본값(20)으로 돌아가는 경우 히스토리 덮어쓰기
5454
if (!replace && this.state.limit === 20 && params.size === 1 && params.has("limit")) {

src/controllers/ProductDetailController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class ProductDetailController {
4545
});
4646

4747
document.querySelector(".go-to-product-list")?.addEventListener("click", () => {
48-
router.navigate("/");
48+
router.navigate(router.BASE_PATH);
4949
});
5050
}
5151
}

src/pages/HomePage.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import ProductCard from "../components/ProductCard.js";
22
import { LoadingCardList } from "../components/LoadingCard.js";
3+
import router from "../router/Router.js";
34

45
export default function HomePage({
56
products = [],
@@ -19,7 +20,7 @@ const 상품목록_레이아웃_로딩 = (products, total, loading, loadingMore,
1920
<div class="max-w-md mx-auto px-4 py-4">
2021
<div class="flex items-center justify-between">
2122
<h1 class="text-xl font-bold text-gray-900">
22-
<a href="/" data-link="">쇼핑몰</a>
23+
<a href="${router.BASE_PATH}" data-link="">쇼핑몰</a>
2324
</h1>
2425
<div class="flex items-center space-x-2">
2526
<!-- 장바구니 아이콘 -->

src/pages/NotFoundPage.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import router from "../router/Router.js";
2+
13
export default function NotFoundPage() {
24
return `
35
<main class="max-w-md mx-auto px-4 py-4">
@@ -29,7 +31,7 @@ export default function NotFoundPage() {
2931
<rect x="130" y="130" width="60" height="2" rx="1" fill="url(#blueGradient)" opacity="0.3"/>
3032
</svg>
3133
32-
<a href="/" data-link class="inline-block px-6 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors">홈으로</a>
34+
<a href="${router.BASE_PATH}" data-link class="inline-block px-6 py-2 bg-blue-500 text-white rounded hover:bg-blue-600 transition-colors">홈으로</a>
3335
</div>
3436
</main>
3537
`;

0 commit comments

Comments
 (0)