Skip to content
46 changes: 46 additions & 0 deletions json/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,51 @@
"postId": "2",
"id": 2
}
],
"products": [
{
"id": 1,
"title": "帶你無痛提升 JavaScript 面試力",
"price": 230
},
{
"id": 2,
"title": "8 天重新認識 JavaScript!",
"price": 290
},
{
"id": 3,
"title": "JavaScript 從入門到放棄",
"price": 390
}
],
"carts": [],
"orders": [
{
"createdAt": 1669186792906,
"info": {
"email": "dev@admin.me",
"username": "",
"address": ""
},
"items": [
{
"productId": "1",
"qty": 7,
"title": "帶你無痛提升 JavaScript 面試力",
"price": 230
},
{
"productId": "2",
"qty": 5,
"title": "8 天重新認識 JavaScript!",
"price": 290
}
],
"payment": 3060,
"hasDelivered": false,
"userId": "1",
"id": 1
}
]
}
12 changes: 10 additions & 2 deletions page/helpers/renderUserMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ function templateOfUserMenu(user, template = '') {
/* end of IF-(isAdmin) */

template += `
<li class="nav-item">
<div>
<a href="/me/carts.html" class="btn btn-sm text-muted px-3 me-2">
購物車
</a>
</div>
</li>

<li class="nav-item">
<div>
<a href="/me/bookmarks.html" class="btn btn-sm text-muted px-3 me-2">
Expand Down Expand Up @@ -55,7 +63,7 @@ function templateOfUserMenu(user, template = '') {
/* end of templateOfUserMenu() */

function renderUserMenu() {
const userId = getLoggedID();
const userId = getLoggedID();
const url = `${BASE_URL}/600/users/${userId}`;

console.log('url >>> ', url);
Expand Down Expand Up @@ -100,7 +108,7 @@ function logout(event) {
localStorage.clear();

setTimeout(() => {
window.location.replace('/');
window.location.replace('/');
}, 300);
/* end of setTimeout */
}
Expand Down
7 changes: 3 additions & 4 deletions page/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@
>
測試用
</a>
</li>
</li> -->

<li class="nav-item">
<a class="nav-link" href="/example">原版範例</a>
</li> -->
<a class="nav-link" href="./products/index.html">商品列表</a>
</li>
</ul>
<!-- end of Left-links -->

Expand Down Expand Up @@ -273,7 +273,6 @@ <h3 class="card-title text-truncate">
*/
function init() {
renderPosts();

}
/* end of init() */

Expand Down
Loading