Skip to content

Commit

Permalink
feat: set up request execution on form submission
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasheartman committed Feb 28, 2022
1 parent 0e4d2cf commit b2a1628
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion website/src/components/UserFeedback/index.jsx
Expand Up @@ -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();
};

Expand Down

0 comments on commit b2a1628

Please sign in to comment.