This commit is contained in:
Shusui MOYATANI
2023-03-17 09:38:28 +09:00
parent 158d0e3a20
commit c34143065b
23 changed files with 421 additions and 246 deletions

View File

@@ -6,24 +6,10 @@ type ConfigProps = {
};
const RelayConfig = () => {
const { config, setConfig } = useConfig();
const { config, setConfig, addRelay, removeRelay } = useConfig();
const [relayUrlInput, setRelayUrlInput] = createSignal<string>('');
const addRelay = (relayUrl: string) => {
setConfig((current) => ({
...current,
relayUrls: [...current.relayUrls, relayUrl],
}));
};
const removeRelay = (relayUrl: string) => {
setConfig((current) => ({
...current,
relayUrls: current.relayUrls.filter((e) => e !== relayUrl),
}));
};
const handleClickAddRelay: JSX.EventHandler<HTMLFormElement, Event> = (ev) => {
ev.preventDefault();
const relayUrl = ev.currentTarget?.relayUrl?.value as string | undefined;