Gitlab@Informatics
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
project-melon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
65160381
project-melon
Commits
d0f51468
Commit
d0f51468
authored
2 months ago
by
65160381
Browse files
Options
Downloads
Patches
Plain Diff
8.3
parent
43f47383
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#604
passed with warnings
2 months ago
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
public/index.html
+4
-4
4 additions, 4 deletions
public/index.html
with
4 additions
and
4 deletions
public/index.html
+
4
−
4
View file @
d0f51468
...
@@ -19,7 +19,7 @@
...
@@ -19,7 +19,7 @@
<a
href=
"cart.html"
>
Cart (
<span
id=
"cart-item-count"
>
0
</span>
)
</a>
<a
href=
"cart.html"
>
Cart (
<span
id=
"cart-item-count"
>
0
</span>
)
</a>
</div>
</div>
<div
class=
"user-info"
>
<div
class=
"user-info"
>
<span
id=
"welcome-message"
>
Welcome, User
</span>
<!-- Display User's
Name
here -->
<span
id=
"welcome-message"
>
Welcome, User
</span>
<!-- Display User's
Email
here -->
<a
href=
"edit-order.html"
class=
"edit-order-btn"
>
Edit Order
</a>
<!-- ปุ่ม Edit Order -->
<a
href=
"edit-order.html"
class=
"edit-order-btn"
>
Edit Order
</a>
<!-- ปุ่ม Edit Order -->
</div>
</div>
<div
class=
"logout"
>
<div
class=
"logout"
>
...
@@ -102,9 +102,9 @@
...
@@ -102,9 +102,9 @@
async
function
displayUsername
()
{
async
function
displayUsername
()
{
try
{
try
{
const
response
=
await
fetch
(
'
/api/getUser
'
);
// Endpoint to get the user
name
const
response
=
await
fetch
(
'
/api/getUser
'
);
// Endpoint to get the user
's email
const
user
=
await
response
.
json
();
const
user
=
await
response
.
json
();
document
.
getElementById
(
'
welcome-message
'
).
innerText
=
`Welcome,
${
user
.
email
}
`
;
document
.
getElementById
(
'
welcome-message
'
).
innerText
=
`Welcome,
${
user
.
email
}
`
;
// Display email here
}
catch
(
error
)
{
}
catch
(
error
)
{
console
.
log
(
'
Error fetching user info:
'
,
error
);
console
.
log
(
'
Error fetching user info:
'
,
error
);
}
}
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
// Initially load products and cart item count
// Initially load products and cart item count
fetchProducts
();
// Fetch all products initially
fetchProducts
();
// Fetch all products initially
updateCart
();
// Update cart count when page loads
updateCart
();
// Update cart count when page loads
displayUsername
();
// Display user
info
when page loads
displayUsername
();
// Display user
's email
when page loads
</script>
</script>
</body>
</body>
</html>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment