1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

feat: set up request execution on form submission

This commit is contained in:
Thomas Heartman 2022-02-28 23:13:07 +01:00
parent 0e4d2cf102
commit b2a1628ff5

View File

@ -90,7 +90,20 @@ export const FeedbackWrapper = ({ seedData, open }) => {
dispatch({ kind: 'set customer type', data: customerType });
const submitFeedback = () => {
console.log('send feedback here ');
fetch(process.env.UNLEASH_FEEDBACK_TARGET_URL, {
method: 'post',
body: JSON.stringify({ data: state.data }),
})
.then(async (res) =>
res.ok
? console.log('Success! Feedback was registered.')
: console.warn(
`Oh, no! The feedback registration failed: ${await res.text()}`,
),
)
.catch((e) =>
console.error('Oh, no! The feedback registration failed:', e),
);
stepForward();
};