oops only send on leaving if there's a rating
This commit is contained in:
parent
ba928a8309
commit
084e8616a5
|
@ -19,6 +19,7 @@ function ChapterFeedback({ chapter }: { chapter: string }) {
|
||||||
}
|
}
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
return () => {
|
return () => {
|
||||||
|
if (rating === undefined) return;
|
||||||
fetch("https://account.lingdocs.com/feedback", {
|
fetch("https://account.lingdocs.com/feedback", {
|
||||||
method: "PUT",
|
method: "PUT",
|
||||||
credentials: "include",
|
credentials: "include",
|
||||||
|
@ -100,10 +101,10 @@ function ChapterFeedback({ chapter }: { chapter: string }) {
|
||||||
<div className="d-flex flex-row justify-content-between align-items-center">
|
<div className="d-flex flex-row justify-content-between align-items-center">
|
||||||
<div className="small">
|
<div className="small">
|
||||||
{(user && !anonymous)
|
{(user && !anonymous)
|
||||||
? `Feedback will be sent as ${user.name}`
|
? `Feedback will be sent as "${user.name}"`
|
||||||
: `Feedback will be anonymous`}
|
: `Feedback will be anonymous`}
|
||||||
</div>
|
</div>
|
||||||
<div className="d-flex flex-row">
|
<div className="d-flex flex-row align-items-center">
|
||||||
{feedbackStatus === "sending" && <div className="mr-3">
|
{feedbackStatus === "sending" && <div className="mr-3">
|
||||||
<samp>sending...</samp>
|
<samp>sending...</samp>
|
||||||
</div>}
|
</div>}
|
||||||
|
@ -121,7 +122,7 @@ function ChapterFeedback({ chapter }: { chapter: string }) {
|
||||||
id="anonymounCheck"
|
id="anonymounCheck"
|
||||||
/>
|
/>
|
||||||
<label className="form-check-label" htmlFor="anonymousCheck">
|
<label className="form-check-label" htmlFor="anonymousCheck">
|
||||||
keep feedback anonymouns
|
stay anonymouns
|
||||||
</label>
|
</label>
|
||||||
</div>}
|
</div>}
|
||||||
</div>}
|
</div>}
|
||||||
|
|
Loading…
Reference in New Issue