Fix: blacklist modal not opening

Fix: no more fetching of non operator added addresses for blacklisted
addresses table.

Fix: trim address white spaces before sending it to database query
This commit is contained in:
Cesar 2020-12-17 16:00:39 +00:00 committed by Josh Harvey
parent e381efed6d
commit 0cd14ba398
3 changed files with 4 additions and 4 deletions

View file

@ -1,8 +1,8 @@
const db = require('./db') const db = require('./db')
// Get all blacklist rows from the DB "blacklist" table // Get all blacklist rows from the DB "blacklist" table that were manually inserted by the operator
const getBlacklist = () => { const getBlacklist = () => {
return db.any('select * from blacklist').then(res => return db.any(`SELECT * FROM blacklist WHERE created_by_operator = 't'`).then(res =>
res.map(item => ({ res.map(item => ({
cryptoCode: item.crypto_code, cryptoCode: item.crypto_code,
address: item.address, address: item.address,

View file

@ -121,7 +121,7 @@ const Blacklist = () => {
return ( return (
<> <>
<TitleSection title="Blacklisted addresses"> <TitleSection title="Blacklisted addresses">
<Link onClick={() => setShowModal(false)}>Blacklist new addresses</Link> <Link onClick={() => setShowModal(true)}>Blacklist new addresses</Link>
</TitleSection> </TitleSection>
<Grid container className={classes.grid}> <Grid container className={classes.grid}>
<Sidebar <Sidebar

View file

@ -45,7 +45,7 @@ const BlackListModal = ({ onClose, selectedCoin, addToBlacklist }) => {
.required('An address is required') .required('An address is required')
})} })}
onSubmit={({ address }, { resetForm }) => { onSubmit={({ address }, { resetForm }) => {
handleAddToBlacklist(address) handleAddToBlacklist(address.trim())
resetForm() resetForm()
}}> }}>
<Form id="address-form"> <Form id="address-form">