diff --git a/frontend/src/components/Footer/Footer.jsx b/frontend/src/components/Footer/Footer.jsx index 70881d4d..a443f99f 100644 --- a/frontend/src/components/Footer/Footer.jsx +++ b/frontend/src/components/Footer/Footer.jsx @@ -1,6 +1,8 @@ import React, { useState } from "react"; import { Link } from "react-router-dom"; import style from "./footer.module.scss"; +import { postSubscriber } from '../../service/Subscriber' +import { SimpleToast } from "../util/Toast"; //react-icon import { FiCheckSquare } from "react-icons/fi"; @@ -12,6 +14,11 @@ export const Footer = (props) => { const [email, setEmail] = useState(""); //setting email error const [emailErr, setEmailErr] = useState({}); + const [toast, setToast] = useState({ + toastStatus: false, + toastType: "", + toastMessage: "", + }); const emailValidation = (email) => { let isValid = true; @@ -47,14 +54,15 @@ export const Footer = (props) => { }; //handling submit - const handleSubmit = (e) => { + const handleSubmit = async(e) => { e.preventDefault(); //if isValid = true, form submission trigger const isValid = validation(); if (isValid) { - setSubmited(true); + const res=await postSubscriber({email},setToast) //resetting email value in state after submission of form - setEmail(""); + if(res) + setEmail(""); } }; var date = new Date(); @@ -87,93 +95,70 @@ export const Footer = (props) => { >
Email: hitktechcommunity@gmail.com
- {submited ? ( -+ Receive updates and news about various Job Opportunities, + Internships, Webinars and Open Source Events. +
+- Receive updates and news about various Job Opportunities, - Internships, Webinars and Open Source Events. -
- + placeholder="Email Id" + onChange={handleEmailChange} + value={email} + /> +Copyright © {year} HITK Tech Community
+ {toast.toastStatus && ( +