diff --git a/src/components/Feedback/index.js b/src/components/Feedback/index.js index e77ac5bebe..83d9c0be56 100644 --- a/src/components/Feedback/index.js +++ b/src/components/Feedback/index.js @@ -3,13 +3,14 @@ /* eslint-disable react-hooks/exhaustive-deps */ /* eslint-disable no-alert */ /* eslint-disable react/prop-types */ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState,useContext } from 'react'; import PropTypes from 'prop-types'; import { Box } from 'grommet'; import { useFormik } from 'formik'; import * as yup from 'yup'; import FeedBackButton from './FeedbackButton/FeedbackButton'; import FeedbackForm from './FeedbackForm/FeedbackForm'; +import { AppContext } from '../../providers/AppProvider'; const isEmpty = (str) => !str.trim().length; @@ -81,6 +82,7 @@ const Feedback = (props) => { }); }; }; + const { user: userDetails } = useContext(AppContext); const successClose = () => { handleClose(); setShowForm(false); @@ -91,10 +93,11 @@ const Feedback = (props) => { value: yup.string().required('Required'), email: yup.string().email('Invalid email format'), }); - const initialState = { - value: '', - email: '', - }; + const initialState = + { + value: '', + email: userDetails?.email || '', + } const feedbackFromik = useFormik({ initialValues: initialState, onSubmit: submithandler,