add text area validation
This commit is contained in:
@@ -57,8 +57,10 @@ export default function CaseComplaint({ selectedViolation }: { selectedViolation
|
||||
|
||||
setShowCreateCase(false);
|
||||
} else if (state && !state.success) {
|
||||
if (state.errorMessage) {
|
||||
toast.warning(t(state.errorMessage));
|
||||
console.log('state.errorMessage');
|
||||
console.log(state.errorMessage);
|
||||
if (state.errorMessage?.server) {
|
||||
toast.warning(t(state.errorMessage.server));
|
||||
} else {
|
||||
toast.warning(t('the-complaint-has-not-been-registered'));
|
||||
}
|
||||
@@ -98,13 +100,35 @@ export default function CaseComplaint({ selectedViolation }: { selectedViolation
|
||||
className="note-textarea"
|
||||
placeholder={`${t('text-of-the-complaint')}...`}>
|
||||
</textarea>
|
||||
<button
|
||||
type="submit"
|
||||
className="btn-small btn-primary-small"
|
||||
disabled={isPending}
|
||||
<div
|
||||
className="flex gap-3"
|
||||
>
|
||||
{t('submit-violation')}
|
||||
</button>
|
||||
<button
|
||||
type="submit"
|
||||
className="btn-small btn-primary-small"
|
||||
disabled={isPending}
|
||||
>
|
||||
{t('submit-violation')}
|
||||
</button>
|
||||
|
||||
{state?.errorMessage?.textArea && (
|
||||
<p
|
||||
className="text-sm text-red-500"
|
||||
>
|
||||
|
||||
{
|
||||
state?.errorMessage?.textArea.split('&').map((e, index) => {
|
||||
return (
|
||||
<span key={index}>
|
||||
{t(e)}
|
||||
<br />
|
||||
</span>
|
||||
)
|
||||
})
|
||||
}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user