add remove relay button

This commit is contained in:
monlovesmango
2023-07-28 13:44:44 -05:00
committed by fiatjaf_
parent b390540b00
commit 20ffa75f19

View File

@@ -108,6 +108,9 @@ function Options() {
onChange={toggleRelayPolicy.bind(null, i, 'write')} onChange={toggleRelayPolicy.bind(null, i, 'write')}
/> />
</label> </label>
<button style={{marginLeft: '10px'}} onClick={removeRelay.bind(null, i)}>
remove
</button>
</div> </div>
))} ))}
<div style={{display: 'flex'}}> <div style={{display: 'flex'}}>
@@ -351,7 +354,15 @@ function Options() {
]) ])
} }
function removeRelay(i) {
setRelays([
...relays.slice(0, i),
...relays.slice(i + 1)
])
}
function addNewRelay() { function addNewRelay() {
if (newRelayURL.trim() === '') return
relays.push({ relays.push({
url: newRelayURL, url: newRelayURL,
policy: {read: true, write: true} policy: {read: true, write: true}