diff --git a/pages/api/feedback.js b/pages/api/feedback.js index 05418e01..fb49fef6 100644 --- a/pages/api/feedback.js +++ b/pages/api/feedback.js @@ -37,16 +37,15 @@ export default async function handler(request, response) { message, page, name, - feedback_email, - subject = 'Palautetta sivustolta: ', + uuid, } = request?.body const form_response = await axios.post(POST_URL, { sender_email, message, page, - subject, + subject: `Palautetta sivustolta: ${page}`, name, - feedback_email, + uuid, webform_id: WEBFORM_ID, }) if (form_response?.status !== 200) { diff --git a/src/components/feedback/FeedbackForm.jsx b/src/components/feedback/FeedbackForm.jsx index 5b5bec62..a5a5948b 100644 --- a/src/components/feedback/FeedbackForm.jsx +++ b/src/components/feedback/FeedbackForm.jsx @@ -5,7 +5,7 @@ import { useForm } from 'react-hook-form' import InfoBlock from '@/components/feedback/InfoBlock' import { isSSR } from '@/hooks/useIsomorphicLayoutEffect' import axios from 'axios' -import { feedbackEmailAtom } from '@/src/store' +import {nodeIdAtom} from '@/src/store' import { useAtomValue } from 'jotai/utils' // eslint-disable-next-line react/display-name @@ -15,7 +15,7 @@ const FeedbackForm = forwardRef(({ onCancel }, ref) => { // Consider using async atom and useAtom hook instead if this becomes a real issue. const { t } = useTranslation('common') - const feedbackEmail = useAtomValue(feedbackEmailAtom) + const nodeId = useAtomValue(nodeIdAtom) const urlWithoutHash = isSSR() === false ? window.location.href.split('#').shift() : '' const { @@ -27,7 +27,7 @@ const FeedbackForm = forwardRef(({ onCancel }, ref) => { } = useForm() const onSubmit = async (data) => - axios.post('/api/feedback', { ...data, feedback_email: feedbackEmail }) + axios.post('/api/feedback', { ...data, uuid: nodeId }) const onError = (errors, e) => { console.error({ errors, e }) @@ -82,11 +82,6 @@ const FeedbackForm = forwardRef(({ onCancel }, ref) => {
-