fix: added message errors to user and channel creation

This commit is contained in:
Lukian 2025-04-06 15:14:17 +02:00
parent 649c43da98
commit 1656e95557
3 changed files with 20 additions and 4 deletions

View file

@ -31,6 +31,11 @@ export default function CreateChannel() {
<Link to="/">Home</Link>
<h1>Create Channel</h1>
<form onSubmit={handleSubmit}>
<p>
{!/^[a-zA-Z0-9-_]+$/.test(name) && name.length != 0 && (
<span>Channel name can only contain letters, numbers, - and _</span>
)}
</p>
<input
type="text"
placeholder="Name"
@ -43,7 +48,9 @@ export default function CreateChannel() {
value={description}
onChange={(e) => setDescription(e.target.value)}
/>
<button type="submit">Create</button>
<button type="submit" disabled={!/^[a-zA-Z0-9-_]+$/.test(name)}>
Create
</button>
</form>
</div>
);