diff --git a/frontend/app/routes/client._index/driving-state/arrived.tsx b/frontend/app/routes/client._index/driving-state/arrived.tsx index a39664cc..f88250d7 100644 --- a/frontend/app/routes/client._index/driving-state/arrived.tsx +++ b/frontend/app/routes/client._index/driving-state/arrived.tsx @@ -14,10 +14,15 @@ import confetti from "canvas-confetti"; export const Arrived = ({ onEvaluated }: { onEvaluated: () => void }) => { const { data } = useClientContext(); const [rating, setRating] = useState(0); + const [errorMessage, setErrorMessage] = useState(); const onClick: MouseEventHandler = useCallback( (e) => { e.preventDefault(); + if (rating < 1 || rating > 5) { + setErrorMessage("評価は1から5の間でなければなりません。") + return; + } try { void fetchAppPostRideEvaluation({ pathParams: { @@ -50,6 +55,7 @@ export const Arrived = ({ onEvaluated }: { onEvaluated: () => void }) => { }, []); return ( + <>
@@ -77,6 +83,8 @@ export const Arrived = ({ onEvaluated }: { onEvaluated: () => void }) => { 評価して料金を支払う
+ {errorMessage && {errorMessage}}
+ ); };