From 31cff49857bf23d045accff2ed7b454eb531a18c Mon Sep 17 00:00:00 2001
From: olechrib <olechrib@stud.ntnu.no>
Date: Sun, 20 Mar 2022 19:55:25 +0100
Subject: [PATCH] Added comments in the profile.js file

---
 frontend/www/scripts/profile.js | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/frontend/www/scripts/profile.js b/frontend/www/scripts/profile.js
index 3448516..39e7867 100644
--- a/frontend/www/scripts/profile.js
+++ b/frontend/www/scripts/profile.js
@@ -9,7 +9,7 @@ function handleCancelButtonDuringCreate() {
 }
 
 /**
- * If user presses "cancel" during editing a group the
+ * If user presses "cancel" during editing the profile the
  * form fields become read only and the form data is deleted.
  * And the buttons change.
  */
@@ -35,7 +35,7 @@ function handleCancelButtonDuringEdit() {
 
 /**
  * If the user clicks on the edit button the form fields can be edited.
- * And the form is updated with the data of the group that the user wants to edit.
+ * And the form is updated with the profile data the user wants to change.
  */
 function handleEditProfileButtonClick() {
     setReadOnly(false, "#form-profile");
@@ -82,8 +82,7 @@ async function getCurrentProfile() {
 }
 
 /**
- * Sends a PUT request to the API to update a group's information.
- * @param {integer} id of the group to be updated
+ * Sends a PUT request to the API to update the active users profile information.
  */
 async function updateProfile() {
     let res = await sendRequest("GET", `${HOST}/api/users/?user=current`);
@@ -123,9 +122,7 @@ async function updateProfile() {
 }
 
 /**
- * When a user enters the group.html this decides whether it
- * is entered in view/edit mode or in create mode. If the html contains
- * a url parameter with an id it is entered in view/edit mode.
+ * When a user enters the profile.html his/her profile information is retrieved
  */
 
 window.addEventListener("DOMContentLoaded", async () => {
-- 
GitLab