| 12 | |
| 13 | export default function ChannelsConfig({ currentCommunity, api }: Props) { |
| 14 | const onSubmit = (target: { id: string; value: string }) => { |
| 15 | if (!target.id || !target.value) return; |
| 16 | if ( |
| 17 | target.id in currentCommunity && |
| 18 | // @ts-ignore |
| 19 | currentCommunity[target.id] === target.value |
| 20 | ) |
| 21 | return; |
| 22 | api |
| 23 | .updateAccount({ |
| 24 | accountId: currentCommunity.id, |
| 25 | [target.id]: target.value, |
| 26 | }) |
| 27 | .then((_) => { |
| 28 | // @ts-ignore |
| 29 | currentCommunity[target.id] = target.value; |
| 30 | }) |
| 31 | .catch(() => { |
| 32 | Toast.error('Something went wrong!'); |
| 33 | }); |
| 34 | }; |
| 35 | |
| 36 | return ( |
| 37 | <> |