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