-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcartPage.html
105 lines (76 loc) · 2.49 KB
/
cartPage.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="icon" href="logo/favicon.png" />
<link rel="stylesheet" href="styles/cartPage.css">
<link rel="stylesheet" href="styles/navbar.css">
<link rel="stylesheet" href="styles/nav2.css">
<!-- <link rel="stylesheet" href="styles/footer_ques.css"> -->
<link rel="stylesheet" href="styles/all.min.css">
</head>
<body>
<div id="nav">
</div>
<div id="container">
</div>
<div id="payment">
<div>
<p>Bag Total</p>
<h3><span>₹ </span> <span id="bag_price"></span></h3>
</div>
<div>
<p>Shipping Charge</p>
<p class="green">Free</p>
</div>
<div>
<h3>Amount Payable</h3>
<h3><span>₹ </span> <span id="total"></span></h3>
</div>
<button id="pay">Proceed payment</button>
</div>
</body>
</html>
<script type="module">
import { navbar } from "./components/navbar.js"
import { cookies } from "./components/cookies.js"
let nav = document.getElementById("nav")
nav.innerHTML = navbar()
let Total = JSON.parse(localStorage.getItem("totalCart"))
if (Total) {
document.getElementById("totalPrice").textContent = Total
}
document.getElementById("totalPrice").addEventListener("click", () => {
window.location.href = "cartPage.html"
})
//***********************************************
//******************
// it is used for disPlay the name on the navbar
const disPlayName = async () => {
let subArr = cookies("token")
// console.log("token", subArr)
let res = await fetch("http://localhost:5901/user", {
method: "POST",
headers: {
"Content-Type": "application/json",
// Authorization: `Bearer ${token}`,
Authorization: `Bearer ${subArr}`,
},
});
let data = await res.json()
// console.log(data)
let userName = document.querySelector("#u-name")
if (!data.name) {
userName.textContent = "Login/SignUp"
}
else {
userName.textContent = data.name
return data
}
}
let unknown = disPlayName()
</script>
<script src="scripts/cartPage.js"></script>