Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async onFormSubmit(event) {
event.preventDefault()
const { domain, reason } = this.state
const minDeposit = (this.state.minDeposit | 0) // coerce
if (domain.startsWith('www.') || domain.startsWith('http') || domain.startsWith('ww.')) {
toastr.error('Please enter a domain with the following format: domain.com')
return
}
if (!isValidDomain(domain)) {
toastr.error('Please enter a valid domain')
return false
}
try {
const adtBalance = await token.getBalance()
if (adtBalance < minDeposit) {
toastr.error('You do not have enough ADT to apply this domain')
return
}
const appExists = await registry.applicationExists(domain)
if (appExists) {
toastr.error('This domain cannot be applied because it already exists within the registry')
return
}
async onFormSubmit (event) {
event.preventDefault()
let {domain} = this.state
const minDeposit = (this.state.minDeposit | 0) // coerce
if (domain.startsWith('www.') || domain.startsWith('http') || domain.startsWith('ww.')) {
toastr.error('Please enter a domain with the following format: domain.com')
return
}
if (!isValidDomain(domain)) {
toastr.error('Please enter a valid domain')
return false
}
try {
const adtBalance = await token.getBalance()
if (adtBalance < minDeposit) {
toastr.error('You do not have enough ADT to apply this domain')
return
}
const appExists = await registry.applicationExists(domain)
if (appExists) {
toastr.error('This domain cannot be applied because it already exists within the registry')
return
}
async onFormSubmit (event) {
event.preventDefault()
const {target} = event
const domain = target.domain.value
const siteName = target.siteName.value
const country = target.country.value
const firstName = target.firstName.value
const lastName = target.lastName.value
const email = target.email.value
const stake = parseInt(target.stake.value.replace(/[^\d]/, ''), 10)
const minDeposit = (this.state.minDeposit | 0) // coerce
if (!isValidDomain(domain)) {
toastr.error('Invalid domain')
return false
}
if (email && !isValidEmail(email)) {
toastr.error('Invalid email')
return false
}
if (!(stake && stake >= minDeposit)) {
toastr.error('Deposit must be equal or greater than the minimum required')
return false
}
if (this._isMounted) {
this.setState({