diff --git a/edit-profile.html b/edit-profile.html index 2fdf685..cdb2871 100644 --- a/edit-profile.html +++ b/edit-profile.html @@ -1,118 +1,125 @@ - - - Profile Dropdown and Edit Profile - - - - - - -
- About Us -
- - + + + Profile Dropdown and Edit Profile + + + + + +
+ About Us +
+
+
- -
-

Edit Profile

-

You are playing as a guest now, add details to identify you.

-
- - + +
+

Edit Profile

+

You are playing as a guest now, add details to identify you.

+ + + - - + + - - -
+ + - - + // Save user profile to local storage + const userProfile = { + name: name, + email: email, + additionalInfo: additionalInfo, + profilePic: URL.createObjectURL(profilePic) // Save the URL of the profile picture + }; + localStorage.setItem("userProfile", JSON.stringify(userProfile)); + + // Show a success message + Swal.fire({ + icon: "success", + title: "Success!", + text: "Your profile has been updated.", + customClass: { + popup: "swal-popup", + title: "swal-title", + content: "swal-content", + confirmButton: "swal-confirm-button", + }, + }).then((result) => { + // Clear the profile form after the user acknowledges the success modal + if (result.isConfirmed || result.isDismissed) { + document.getElementById("edit-profile").reset(); + // Update the main profile picture in the header + document.getElementById("main-profile-pic").src = userProfile.profilePic; + } + }); + } + + // Attach the submitProfile function to the form's submit event + document.getElementById("edit-profile").addEventListener("submit", submitProfile); + +