Contact Saga handler
export function* handlePostContactUser(action) {
try {
yield call(axios.post, '*endpoint*', action.data);
} catch (error) {
throw error;
}
};
Front-end form handleSubmit function:
let handleContactFormSubmit = () => {
let name = input.name;
let email = input.email;
let message = input.message;
dispatch({ type: 'POST_CONTACT_USER', data: {name, email, message, date}});
}
RootSaga
export function* watcherSaga() {
yield all([
takeEvery("POST_CONTACT_USER", handlePostContactUser)
]);
};
Based on this code, how could I display a message on the front end after the form submits, based on if it was successful or not? If it was, then just redirect/refresh the page, if not, display an error on the screen for the user to see