This commit is contained in:
parent
f7f06a7ebc
commit
cb3237c51c
|
@ -17,21 +17,26 @@ function ChapterFeedback({ chapter }: { chapter: string }) {
|
||||||
function handleRatingClick(v: number) {
|
function handleRatingClick(v: number) {
|
||||||
setRating(o => o === v ? undefined : v);
|
setRating(o => o === v ? undefined : v);
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
// automatic sending of emoji click feedback if someone leaves the chapter without
|
||||||
return () => {
|
// filling in and sending the feedback textbox
|
||||||
if (rating === undefined || feedbackStatus === "sent") return;
|
// not doing this yet because not sure if it's a clean setup like "componentWillUnmount"
|
||||||
fetch("https://account.lingdocs.com/feedback", {
|
// or if it unecessarily unmounts and re-renders
|
||||||
method: "PUT",
|
// useEffect(() => {
|
||||||
credentials: "include",
|
// return () => {
|
||||||
headers: {
|
// if (rating === undefined || feedbackStatus === "sent") return;
|
||||||
"Content-Type": "application/json",
|
// fetch("https://account.lingdocs.com/feedback", {
|
||||||
},
|
// method: "PUT",
|
||||||
body: JSON.stringify({ feedback: "", rating }),
|
// credentials: "include",
|
||||||
}).catch(() => {
|
// headers: {
|
||||||
console.error("couldn't send chapter feedback");
|
// "Content-Type": "application/json",
|
||||||
});
|
// },
|
||||||
}
|
// body: JSON.stringify({ feedback: "", rating }),
|
||||||
}, []);
|
// }).catch(() => {
|
||||||
|
// console.error("couldn't send chapter feedback");
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// // eslint-disable-next-line
|
||||||
|
// }, []);
|
||||||
function handleSendFeedback() {
|
function handleSendFeedback() {
|
||||||
const toSend = {
|
const toSend = {
|
||||||
chapter,
|
chapter,
|
||||||
|
|
Loading…
Reference in New Issue