").addClass("recent-item").html(`
+
+
${user.name}
+
×
+ `);
+ listItem.data("user", user);
+ $recentList.append(listItem);
+ });
+ }
+
+ function displayNoResults() {
+ $recentList.html('
No results found
');
+ }
+
+ function displayError() {
+ $recentList.html(
+ '
An error occurred. Please try again.
'
+ );
+ }
+
+ function clearResults() {
+ $recentList.empty();
+ }
+
+ function handleScroll() {
+ const scrollTop = $recentList.scrollTop();
+ const scrollHeight = $recentList[0].scrollHeight;
+ const clientHeight = $recentList.height();
+
+ if (
+ scrollTop + clientHeight >= scrollHeight - 5 &&
+ !isLoading &&
+ hasMoreResults
+ ) {
+ console.log("Loading more results");
+ fetchAndDisplayResults();
+ }
+ }
+
+ function handleResultClick(event) {
+ const $clickedItem = $(event.currentTarget);
+ const userData = $clickedItem.data("user");
+
+ if (userData) {
+ saveRecentSearch(userData);
+ localStorage.setItem("selectedFriendEmail", userData.email);
+
+ const $iframe = $(window.parent.document).find(
+ "#homePage .homeWallComponent iframe"
+ );
+
+ $iframe.attr(
+ "src",
+ "../components/pages/wall/myFriendPostWallComponent.html"
+ );
+ }
+ }
+
+ function handleRemoveClick(event) {
+ event.stopPropagation();
+ const $clickedItem = $(event.target).closest(".recent-item");
+ const userData = $clickedItem.data("user");
+
+ if (userData) {
+ removeRecentSearch(userData);
+ $clickedItem.remove();
+ }
+ }
+
+ function saveRecentSearch(userData) {
+ let recentSearches = JSON.parse(
+ localStorage.getItem("recentSearches") || "[]"
+ );
+
+ const idExists = recentSearches.some((user) => user.name === userData.name);
+
+ if (!idExists) {
+ if (recentSearches.length === 5) {
+ recentSearches.shift();
+ }
+ recentSearches.push(userData);
+ localStorage.setItem("recentSearches", JSON.stringify(recentSearches));
+ }
+ }
+
+ function removeRecentSearch(userData) {
+ let recentSearches = JSON.parse(
+ localStorage.getItem("recentSearches") || "[]"
+ );
+ recentSearches = recentSearches.filter(
+ (user) => user.name !== userData.name
+ );
+ localStorage.setItem("recentSearches", JSON.stringify(recentSearches));
+ }
+
+ function showRecentSearches() {
+ const recentSearches = JSON.parse(
+ localStorage.getItem("recentSearches") || "[]"
+ );
+ clearResults();
+ if (recentSearches.length > 0) {
+ $recentContainer.find("h2").text("Recent");
+ displayResults(recentSearches.reverse());
+ } else {
+ displayNoResults();
+ }
+ }
+
+ initEventListeners();
+ showRecentSearches();
+});
+
+function getJwtToken() {
+ const cookies = document.cookie.split("; ");
+ for (let cookie of cookies) {
+ if (cookie.startsWith("jwt=")) {
+ return cookie.split("=")[1];
+ }
+ }
+ return null;
+}
diff --git a/controller/SearchPopupController.js b/controller/SearchPopupController.js
index e69de29..eeaf124 100644
--- a/controller/SearchPopupController.js
+++ b/controller/SearchPopupController.js
@@ -0,0 +1,241 @@
+import { searchUsers } from "../model/SearchPopupModel.js";
+
+$(document).ready(function () {
+ let currentPage = 0;
+ let isLoading = false;
+ let hasMoreResults = true;
+ let currentSearchTerm = "";
+
+ const $searchInput = $("#search-for-friends");
+ const $searchPopup = $("#searchPopUp");
+ const $searchPopupList = $("#searchPopupList");
+ const $recentList = $("#recent-list");
+ const $searchTitle = $("#search-title");
+
+ function initEventListeners() {
+ $searchInput.on("click", function () {
+ showSearchPopup();
+ });
+
+ $searchInput.on("keypress", function (e) {
+ if (e.which === 13) {
+ e.preventDefault();
+ handleSearch();
+ }
+ });
+
+ $searchInput.on("input", function () {
+ if ($(this).val().trim() === "") {
+ resetSearch();
+ showRecentSearches();
+ }
+ });
+
+ $(document).on("click", function (event) {
+ if (
+ !$(event.target).closest("#search-for-friends, #searchPopUp").length
+ ) {
+ $searchPopup.hide();
+ }
+ });
+
+ $recentList.on("scroll", handleScroll);
+ $recentList.on("click", ".search-result", handleResultClick);
+ $recentList.on("click", ".remove-btn", handleRemoveClick);
+ }
+
+ function showSearchPopup() {
+ showRecentSearches();
+ $searchPopup.show();
+ }
+
+ function handleSearch() {
+ const newSearchTerm = $searchInput.val().trim();
+ if (newSearchTerm !== currentSearchTerm) {
+ resetSearch();
+ currentSearchTerm = newSearchTerm;
+ if (currentSearchTerm) {
+ $searchPopup.show();
+ $searchTitle.text("Results");
+ fetchAndDisplayResults();
+ } else {
+ $searchTitle.text("Recent");
+ showRecentSearches();
+ }
+ }
+ }
+
+ function resetSearch() {
+ currentPage = 0;
+ hasMoreResults = true;
+ currentSearchTerm = "";
+ clearResults();
+ $searchTitle.text("Recent");
+ adjustPopupHeight(0);
+ }
+
+ function fetchAndDisplayResults() {
+ if (isLoading || !hasMoreResults || !currentSearchTerm) return;
+
+ isLoading = true;
+ searchUsers(currentSearchTerm, currentPage)
+ .then(function (results) {
+ if (Array.isArray(results) && results.length > 0) {
+ displayResults(results);
+ currentPage++;
+ hasMoreResults = results.length === 10;
+ adjustPopupHeight($recentList.children().length);
+ } else {
+ hasMoreResults = false;
+ displayNoResults();
+ adjustPopupHeight(1);
+ }
+ })
+ .catch(function (error) {
+ console.error("Error fetching search results:", error);
+ if (error.response && error.response.status === 404) {
+ hasMoreResults = false;
+ displayNoResults();
+ adjustPopupHeight(1);
+ } else {
+ displayError();
+ adjustPopupHeight(1);
+ }
+ })
+ .finally(function () {
+ isLoading = false;
+ });
+ }
+
+ function displayResults(results) {
+ $.each(results, function (index, user) {
+ const listItem = $("
").addClass(
+ "d-flex justify-content-between align-items-center"
+ ).html(`
+
+
+
${user.name}
+
+ ×
+ `);
+ listItem.data("user", user);
+ $recentList.append(listItem);
+ });
+ }
+
+ function displayNoResults() {
+ $recentList.html(' No results found ');
+ }
+
+ function displayError() {
+ $recentList.html(
+ '
An error occurred. Please try again. '
+ );
+ }
+
+ function clearResults() {
+ $recentList.empty();
+ }
+
+ function handleScroll() {
+ const scrollTop = $recentList.scrollTop();
+ const scrollHeight = $recentList[0].scrollHeight;
+ const clientHeight = $recentList.height();
+
+ if (
+ scrollTop + clientHeight >= scrollHeight - 5 &&
+ !isLoading &&
+ hasMoreResults
+ ) {
+ console.log("Loading more results");
+ fetchAndDisplayResults();
+ }
+ }
+
+ function adjustPopupHeight(resultCount) {
+ const baseHeight = 100;
+ const itemHeight = 50;
+ const maxHeight = 400;
+
+ let newHeight = baseHeight + resultCount * itemHeight;
+ newHeight = Math.min(newHeight, maxHeight);
+
+ $searchPopupList.css("height", `${newHeight}px`);
+ }
+
+ function handleResultClick(event) {
+ const $clickedItem = $(event.currentTarget).closest("li");
+ const userData = $clickedItem.data("user");
+
+ if (userData) {
+ saveRecentSearch(userData);
+
+ localStorage.setItem("selectedFriendEmail", userData.email);
+ const $iframe = $("#homePage .homeWallComponent iframe");
+ $iframe.attr(
+ "src",
+ "../components/pages/wall/myFriendPostWallComponent.html"
+ );
+ }
+ }
+
+ function handleRemoveClick(event) {
+ event.stopPropagation();
+ const $clickedItem = $(event.target).closest("li");
+ const userData = $clickedItem.data("user");
+
+ if (userData) {
+ removeRecentSearch(userData);
+ $clickedItem.remove();
+ }
+ }
+
+ // Add click event listener
+ $(document).on("click", ".remove-btn", handleRemoveClick);
+ function removeRecentSearch(userData) {
+ let recentSearches = JSON.parse(
+ localStorage.getItem("recentSearches") || "[]"
+ );
+ recentSearches = recentSearches.filter(
+ (user) => user.name !== userData.name
+ );
+ localStorage.setItem("recentSearches", JSON.stringify(recentSearches));
+ }
+
+ function saveRecentSearch(userData) {
+ let recentSearches = JSON.parse(
+ localStorage.getItem("recentSearches") || "[]"
+ );
+
+ const idExists = recentSearches.some((user) => user.name === userData.name);
+
+ if (!idExists) {
+ if (recentSearches.length === 5) {
+ recentSearches.shift();
+ }
+ recentSearches.push(userData);
+ localStorage.setItem("recentSearches", JSON.stringify(recentSearches));
+ }
+ }
+
+ function showRecentSearches() {
+ const recentSearches = JSON.parse(
+ localStorage.getItem("recentSearches") || "[]"
+ );
+ clearResults();
+ if (recentSearches.length > 0) {
+ $searchTitle.text("Recent");
+ displayResults(recentSearches.reverse());
+ adjustPopupHeight(recentSearches.length);
+ } else {
+ displayNoResults();
+ adjustPopupHeight(1);
+ }
+ }
+
+ initEventListeners();
+});
diff --git a/controller/forgotPasswordOtpVerifyPageController.js b/controller/forgotPasswordOtpVerifyPageController.js
new file mode 100644
index 0000000..a13388e
--- /dev/null
+++ b/controller/forgotPasswordOtpVerifyPageController.js
@@ -0,0 +1,151 @@
+import { postDataForOtp } from "../model/VerificationFormModel.js";
+import { updateUserPassword } from "../model/UserProfileModel.js";
+
+$(document).ready(function () {
+ //Add validation
+ $(".otp-input").each(function () {
+ $(this).attr("required", true);
+ });
+
+ const email = localStorage.getItem("email");
+ const newPassword = localStorage.getItem("newPassword");
+
+ if (!postData("", email))
+ Toastify({
+ text: "Failed to send data. Please try again.",
+ duration: 3000,
+ gravity: "top",
+ position: "right",
+ backgroundColor: "#ff0000",
+ close: true,
+ stopOnFocus: true,
+ }).showToast();
+
+ $(".otp-input").each(function (index, input) {
+ $(input).on("input", function () {
+ if ($(input).val().length >= 1 && index < $(".otp-input").length - 1) {
+ $($(".otp-input")[index + 1]).focus();
+ }
+
+ if ($(input).val().length === 0 && index > 0) {
+ $($(".otp-input")[index - 1]).focus();
+ }
+ });
+ });
+
+ $(".Reset-Password").submit(async function (event) {
+ event.preventDefault();
+
+ if (this.checkValidity()) {
+ let otpValues = [];
+ $(".otp-input").each(function () {
+ otpValues.push($(this).val().trim());
+ });
+
+ if (otpValues.length > 0) {
+ const combinedOtp = otpValues.join("");
+ const isUpdated = await updatePassword(email, newPassword, combinedOtp);
+ if (isUpdated) {
+ Toastify({
+ text: "Password updated successfully!",
+ duration: 3000,
+ gravity: "top",
+ position: "center",
+ backgroundColor: "#00b09b",
+ close: true,
+ stopOnFocus: true,
+ }).showToast();
+ localStorage.removeItem("email");
+ localStorage.removeItem("newPassword");
+ window.location.href = "/index.html";
+ }
+
+ $(".otp-field").each(function () {
+ $(this).val("");
+ });
+ } else {
+ Toastify({
+ text: "No OTP values entered.",
+ duration: 3000,
+ gravity: "top",
+ position: "right",
+ backgroundColor: "#ff0000",
+ close: true,
+ stopOnFocus: true,
+ }).showToast();
+ }
+ } else {
+ this.reportValidity();
+ }
+ });
+
+ $("#resend").on("click", function (event) {
+ event.preventDefault();
+
+ if (!postData("", email))
+ Toastify({
+ text: "Failed to send data. Please try again.",
+ duration: 3000,
+ gravity: "top",
+ position: "right",
+ backgroundColor: "#ff0000",
+ close: true,
+ stopOnFocus: true,
+ }).showToast();
+ else {
+ $(".otp-input").each(function () {
+ $(this).val("");
+ });
+ }
+ });
+});
+
+const updatePassword = async (email, password, otp) => {
+ try {
+ const response = await updateUserPassword(email, password, otp);
+ return response.status === 204 ? true : false;
+ } catch (error) {
+ console.error("Error updating password:", error);
+ if (error.response.status === 400)
+ Toastify({
+ text: "Invalid OTP. Please try again.",
+ duration: 3000,
+ gravity: "top",
+ position: "right",
+ backgroundColor: "#ff0000",
+ close: true,
+ stopOnFocus: true,
+ }).showToast();
+ else if (error.response.status === 404)
+ Toastify({
+ text: "User not found.",
+ duration: 3000,
+ gravity: "top",
+ position: "right",
+ backgroundColor: "#ff0000",
+ close: true,
+ stopOnFocus: true,
+ }).showToast();
+ else
+ Toastify({
+ text: "Error updating password",
+ duration: 3000,
+ gravity: "top",
+ position: "right",
+ backgroundColor: "#ff0000",
+ close: true,
+ stopOnFocus: true,
+ }).showToast();
+ return false;
+ }
+};
+
+const postData = async (name, email) => {
+ try {
+ const otpResponse = await postDataForOtp(name, email);
+ return otpResponse.status === 200 ? true : false;
+ } catch (error) {
+ console.error("Error sending data:", error);
+ return false;
+ }
+};
diff --git a/index.html b/index.html
index 8bfd507..d7ab5ed 100644
--- a/index.html
+++ b/index.html
@@ -1,11 +1,81 @@
+
-
-
-
SE10-NETWORK LOGIN
+
+
+
SE10-NETWORK LOGIN
+
+
+
+
+
+
+
-
SE10-NETWORK
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/model/HomePageModel.js b/model/HomePageModel.js
index e69de29..2788bc9 100644
--- a/model/HomePageModel.js
+++ b/model/HomePageModel.js
@@ -0,0 +1,53 @@
+export const getTokenValidation = () => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: "http://localhost:8080/api/v1/user/validate",
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Validation successful:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Validation failed:", error);
+ throw error;
+ });
+};
+
+export const getBirthdayNames = () => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: "http://localhost:8080/api/v1/user/birthday/names",
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Birthday names retrieved successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Request failed:", error);
+ throw error;
+ });
+};
+
+export const getBirthdayData = () => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: "http://localhost:8080/api/v1/user/birthday/data",
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Birthday data retrieved successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Request failed:", error);
+ throw error;
+ });
+};
diff --git a/model/InspireModel.js b/model/InspireModel.js
new file mode 100644
index 0000000..9ca223c
--- /dev/null
+++ b/model/InspireModel.js
@@ -0,0 +1,35 @@
+export const saveInspiration = (data) => {
+ let config = {
+ method: "post",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/inspire`,
+ data: data,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Inspiration saved successfully:", response.code);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Unable to save inspiration:", error);
+ throw error;
+ });
+};
+
+export const deleteInspiration = (postId) => {
+ let config = {
+ method: "delete",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/inspire/post/${postId}`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Inspiration deleted successfully:", response.code);
+ })
+ .catch((error) => {
+ console.error("Unable to delete inspiration:", error);
+ throw error;
+ });
+};
diff --git a/model/LoginFormModel.js b/model/LoginFormModel.js
new file mode 100644
index 0000000..dc51269
--- /dev/null
+++ b/model/LoginFormModel.js
@@ -0,0 +1,21 @@
+export const postLoginData = (data) => {
+ let config = {
+ method: "post",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/auth/sign_in`,
+ headers: {
+ "Content-Type": "application/json",
+ },
+ data: JSON.stringify(data),
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Login successful:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Login failed:", error);
+ throw error;
+ });
+};
diff --git a/model/MyPostPageModel.js b/model/MyPostPageModel.js
deleted file mode 100644
index e69de29..0000000
diff --git a/model/NotificationModel.js b/model/NotificationModel.js
new file mode 100644
index 0000000..1e5d6a7
--- /dev/null
+++ b/model/NotificationModel.js
@@ -0,0 +1,33 @@
+export const getNotifications = (id) => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/notification/user/${id}`,
+ params: {
+ pageNo: 0,
+ notificationCount: 10,
+ },
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Data Retrieved successfully:", response.status);
+ return response.data;
+ })
+ .catch((error) => {
+ if (error.response) {
+ if (error.response.status === 404) {
+ console.warn("No notifications found for user ID:", id);
+ return [];
+ } else {
+ console.error(
+ "Error occurred:",
+ error.response.status,
+ error.response.data
+ );
+ }
+ } else {
+ console.error("Network or unknown error occurred:", error.message);
+ }
+ });
+};
diff --git a/model/NotificationsPopupModel.js b/model/NotificationsPopupModel.js
deleted file mode 100644
index e69de29..0000000
diff --git a/model/PostCardModel.js b/model/PostCardModel.js
new file mode 100644
index 0000000..c9cfb4d
--- /dev/null
+++ b/model/PostCardModel.js
@@ -0,0 +1,178 @@
+// --- save post (create-post-card) ---
+export const savePost = (data) => {
+ let config = {
+ method: "post",
+ maxBodyLength: Infinity,
+ url: "http://localhost:8080/api/v1/post",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ data: data,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Post saved successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Unable to save the post:", error);
+ throw error;
+ });
+};
+
+// --- update post ---
+export const updatePost = (id, content) => {
+ let config = {
+ method: "put",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/post/${id}`,
+ headers: {
+ "Content-Type": "text/plain",
+ },
+ data: content,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Post update successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Unable to update the post:", error);
+ throw error;
+ });
+};
+
+// --- approve or decline a post ---
+export const approveOrDeclinePost = (postId, status) => {
+ let config = {
+ method: "put",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/post/${postId}/status?status=${status}`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Post status changed successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Unable to change staus of the post:", error);
+ throw error;
+ });
+};
+
+// --- get post data ---
+export const getPostData = (postId) => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/post/${postId}`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Post fetched successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Unable to find the post:", error);
+ throw error;
+ });
+};
+
+// --- get all posts ---
+export const getAllPosts = (pageNo) => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/post?pageNo=${pageNo}&postCount=10`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Posts fetched successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Unable to find the posts:", error);
+ throw error;
+ });
+};
+
+// --- get all posts of a user ---
+export const getAllPostsOfUser = (pageNo) => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/post/user?pageNo=${pageNo}&postCount=10`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Posts fetched successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Unable to find the posts:", error);
+ throw error;
+ });
+};
+
+// --- get all unapproved posts ---
+export const getUnapprovedPosts = (pageNo) => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/post/unapproved?pageNo=${pageNo}&postCount=10`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Unapproved posts fetched successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Unable to find the unapproved posts:", error);
+ throw error;
+ });
+};
+
+// --- delete post ---
+export const deletePost = (postId) => {
+ let config = {
+ method: "delete",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/post/${postId}`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Post deleted successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.log("Post delete failed:", error);
+ return error;
+ });
+};
+
+// --- get all posts of a friend ---
+export const getAllFriendPosts = (pageNo, email) => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/post/userPosts?pageNo=${pageNo}&postCount=10&email=${email}`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Posts fetched successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Unable to find the posts:", error);
+ throw error;
+ });
+};
diff --git a/model/PostMoreOptionsPopUpModel.js b/model/PostMoreOptionsPopUpModel.js
deleted file mode 100644
index e69de29..0000000
diff --git a/model/ProfilePageModel.js b/model/ProfilePageModel.js
deleted file mode 100644
index e69de29..0000000
diff --git a/model/RegistrationFormModel.js b/model/RegistrationFormModel.js
index e69de29..cf9b92d 100644
--- a/model/RegistrationFormModel.js
+++ b/model/RegistrationFormModel.js
@@ -0,0 +1,21 @@
+export const postRegisterData = (formDataToSend) => {
+ let config = {
+ method: "post",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/auth/sign_up`,
+ data: formDataToSend,
+ headers: {
+ "Content-Type": "multipart/form-data",
+ },
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Registration successful:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Registration failed:", error);
+ throw error;
+ });
+};
diff --git a/model/SearchPopupModel.js b/model/SearchPopupModel.js
index e69de29..0d607cc 100644
--- a/model/SearchPopupModel.js
+++ b/model/SearchPopupModel.js
@@ -0,0 +1,20 @@
+export const searchUsers = (searchTerm, pageNo) => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/user/search?name=${searchTerm}&pageNo=${pageNo}`,
+ headers: {
+ "Content-Type": "application/json",
+ },
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Search successful:", response.status);
+ return response.data;
+ })
+ .catch((error) => {
+ console.error("Search failed:", error);
+ throw error;
+ });
+};
diff --git a/model/UserProfileModel.js b/model/UserProfileModel.js
new file mode 100644
index 0000000..e9a9096
--- /dev/null
+++ b/model/UserProfileModel.js
@@ -0,0 +1,171 @@
+export const getUserData = () => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/user`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Data Retrieved successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Data Retrieval failed:", error);
+ throw error;
+ });
+};
+
+export const getUserProfilePhoto = () => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: "http://localhost:8080/api/v1/user/profileImg",
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Data Retrieved successfully");
+ return response.data;
+ })
+ .catch((error) => {
+ console.error("Data Retrieval failed:", error);
+ throw error;
+ });
+};
+
+export const updateUserData = (data) => {
+ let config = {
+ method: "put",
+ maxBodyLength: Infinity,
+ url: "http://localhost:8080/api/v1/user",
+ data: data,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Update successful:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ if (error.response && error.response.data) {
+ return Promise.reject({
+ code: error.response.data.code,
+ message: error.response.data.message,
+ });
+ } else {
+ return Promise.reject(error);
+ }
+ });
+};
+
+export const deleteUser = (id) => {
+ let config = {
+ method: "delete",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/user/${id}`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Delete successful!");
+ return response;
+ })
+ .catch((error) => {
+ console.error("Delete failed:", error);
+ throw error;
+ });
+};
+
+export const updateUserPhoto = (formData) => {
+ let config = {
+ method: "put",
+ maxBodyLength: Infinity,
+ url: "http://localhost:8080/api/v1/user/image",
+ data: formData,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Update successful:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Update failed:", error);
+ throw error;
+ });
+};
+
+export const updateUserPassword = (email, newPassword, otp) => {
+ let config = {
+ method: "put",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/auth/update_password`,
+ data: { email, newPassword, otp },
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Password update successful:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Password update failed:", error);
+ throw error;
+ });
+};
+
+export const deleteUserData = (id) => {
+ let config = {
+ method: "delete",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/user/${id}`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Delete successful:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Delete failed:", error);
+ throw error;
+ });
+};
+
+export const deleteUserPhoto = (data) => {
+ let config = {
+ method: "delete",
+ maxBodyLength: Infinity,
+ url: "http://localhost:8080/api/v1/user/image",
+ data: data,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Delete successful:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Delete failed:", error);
+ throw error;
+ });
+};
+
+export const getFriendData = (email) => {
+ let config = {
+ method: "get",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/user/${email}`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Data Retrieved successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Data Retrieval failed:", error);
+ throw error;
+ });
+};
diff --git a/model/VerificationFormModel.js b/model/VerificationFormModel.js
new file mode 100644
index 0000000..bb9fac7
--- /dev/null
+++ b/model/VerificationFormModel.js
@@ -0,0 +1,17 @@
+export const postDataForOtp = (name, email) => {
+ let config = {
+ method: "post",
+ maxBodyLength: Infinity,
+ url: `http://localhost:8080/api/v1/auth/request_otp?name=${name}&email=${email}`,
+ };
+
+ return axios(config)
+ .then((response) => {
+ console.log("Otp sent successfully:", response.status);
+ return response;
+ })
+ .catch((error) => {
+ console.error("Otp sent failed:", error);
+ throw error;
+ });
+};
diff --git a/pages/adminApprovePageMobile.html b/pages/adminApprovePageMobile.html
new file mode 100644
index 0000000..9d5b837
--- /dev/null
+++ b/pages/adminApprovePageMobile.html
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+
+
+
+
+
SE10 NETWORK
+
+
+
+
Approve
+ Home
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/birthdayPageMobile.html b/pages/birthdayPageMobile.html
new file mode 100644
index 0000000..31920ff
--- /dev/null
+++ b/pages/birthdayPageMobile.html
@@ -0,0 +1,34 @@
+
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
+
+
+
+
Birthdays
+ Notifications
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/error404Page.html b/pages/error404Page.html
new file mode 100644
index 0000000..1583a7d
--- /dev/null
+++ b/pages/error404Page.html
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
Page Not Found - Error 404
+
+
+
+
+
+
+
+
404
+
Page Not Found!
+
+ It looks like the page you're trying to reach doesn't
+
+ exist or has been moved.
+
+
Back to Home
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/forgotPasswordForm.html b/pages/forgotPasswordForm.html
new file mode 100644
index 0000000..94fe983
--- /dev/null
+++ b/pages/forgotPasswordForm.html
@@ -0,0 +1,109 @@
+
+
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/forgotPasswordOtpVerifyPage.html b/pages/forgotPasswordOtpVerifyPage.html
new file mode 100644
index 0000000..2c5a61d
--- /dev/null
+++ b/pages/forgotPasswordOtpVerifyPage.html
@@ -0,0 +1,106 @@
+
+
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/homePage.html b/pages/homePage.html
index 48e69dd..ad7e785 100644
--- a/pages/homePage.html
+++ b/pages/homePage.html
@@ -1,11 +1,231 @@
-
-
-
-
HOME
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
+
+ SE10
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ My Profile
+
+
+
+
+
+
+ My Post
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Birthdays
+
+
+
+
No one has birthdays today
+
+
+
+
+
+
+
Notifications
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/mobileHomePage.html b/pages/mobileHomePage.html
new file mode 100644
index 0000000..30e35c1
--- /dev/null
+++ b/pages/mobileHomePage.html
@@ -0,0 +1,107 @@
+
+
+
+
+
+
+
+
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
Home
+ Approve
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/myPostPage.html b/pages/myPostPage.html
deleted file mode 100644
index 4614603..0000000
--- a/pages/myPostPage.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
MY-POST-PAGE
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/notificationPageMobile.html b/pages/notificationPageMobile.html
new file mode 100644
index 0000000..08158ed
--- /dev/null
+++ b/pages/notificationPageMobile.html
@@ -0,0 +1,36 @@
+
+
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
+
+
+
+
Notifications
+ Birthdays
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/notificationsPopup.html b/pages/notificationsPopup.html
deleted file mode 100644
index 6f6462a..0000000
--- a/pages/notificationsPopup.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
NOTIFICATIONS
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/postMoreOptionsPopUp.html b/pages/postMoreOptionsPopUp.html
deleted file mode 100644
index 7785369..0000000
--- a/pages/postMoreOptionsPopUp.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
POST-MORE-OPTIONS
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/profilePage.html b/pages/profilePage.html
deleted file mode 100644
index d20b661..0000000
--- a/pages/profilePage.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
PROFILE
-
-
-
-
-
\ No newline at end of file
diff --git a/pages/registrationForm.html b/pages/registrationForm.html
index 3a8326c..1f15e15 100644
--- a/pages/registrationForm.html
+++ b/pages/registrationForm.html
@@ -1,13 +1,139 @@
-
-
-
-
Test Page 01
-
-
-
-
Test Page 01
-
-
-
\ No newline at end of file
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/registrationForm2.html b/pages/registrationForm2.html
new file mode 100644
index 0000000..6386b01
--- /dev/null
+++ b/pages/registrationForm2.html
@@ -0,0 +1,157 @@
+
+
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/registrationOtpVerifyPage.html b/pages/registrationOtpVerifyPage.html
new file mode 100644
index 0000000..4fb0fc7
--- /dev/null
+++ b/pages/registrationOtpVerifyPage.html
@@ -0,0 +1,97 @@
+
+
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/searchPageMobile.html b/pages/searchPageMobile.html
new file mode 100644
index 0000000..3c59c26
--- /dev/null
+++ b/pages/searchPageMobile.html
@@ -0,0 +1,33 @@
+
+
+
+
+
+
SE10 NETWORK
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/searchPopup.html b/pages/searchPopup.html
deleted file mode 100644
index 987bf7d..0000000
--- a/pages/searchPopup.html
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-
-
-
-
SEARCH-POPUP
-
-
-
-
-
\ No newline at end of file