Skip to content
This repository was archived by the owner on Dec 2, 2022. It is now read-only.

Commit 14472d6

Browse files
committed
validation fixes,
1 parent 2558bb9 commit 14472d6

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/ui/components/argit/newRepoForm.tsx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,20 +43,21 @@ class NewRepoForm extends Component<NewRepoFormProps, NewRepoFormState> {
4343
}
4444

4545
validate = () => {
46-
let errors = { name: "" }
46+
const errors = { name: "" }
4747
const { repo } = this.state
48-
console.log(this.checkIfExists(repo.name))
4948
if (repo.name.trim() === "") {
5049
errors.name = "Repository Name is required"
51-
} else if (!/[A-Za-z0-9_.-]*/.test(repo.name)) {
50+
}
51+
if (!/^[A-Za-z0-9_.-]*$/.test(repo.name)) {
5252
errors.name =
5353
"Repository name should only include alphanumeric characters, _, . or -"
54-
} else if (this.checkIfExists(repo.name)) {
54+
}
55+
if (this.checkIfExists(repo.name)) {
5556
errors.name = "Repository Name already exists"
56-
} else {
57+
}
58+
if (errors.name == "") {
5759
return null
5860
}
59-
console.log(errors)
6061
return errors
6162
}
6263

@@ -141,8 +142,7 @@ class NewRepoForm extends Component<NewRepoFormProps, NewRepoFormState> {
141142
const { repo, errors } = this.state
142143
return (
143144
<div>
144-
<h2>Create Project</h2>
145-
<p>Create a new Repository to the local fs and arweave</p>
145+
<h2>Create Repository</h2>
146146
<br />
147147
<form onSubmit={this.handleSubmit}>
148148
<Input

src/ui/components/organisms/CreateRepoModal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export const CreateRepoModal = connector(
4444
closeModal({})
4545
}}
4646
>
47-
<ModalHeader toggle={closeModal}>Login</ModalHeader>
47+
<ModalHeader toggle={closeModal} />
4848

4949
<ModalBody>
5050
<NewRepoForm

0 commit comments

Comments
 (0)