MCPcopy Create free account
hub / github.com/Linen-dev/linen.dev / onSubmit

Function onSubmit

apps/web/ui/ConfigurationsView/ChannelsConfig/index.tsx:14–34  ·  view source on GitHub ↗
(target: { id: string; value: string })

Source from the content-addressed store, hash-verified

12
13export 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 <>

Callers 1

ChannelsConfigFunction · 0.70

Calls 1

errorMethod · 0.65

Tested by

no test coverage detected