Skip to content

Commit ca7733a

Browse files
committed
feat(xen-tg-app): use capability ID instead of name and domain
1 parent 421f695 commit ca7733a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

apps/xen-tg-app/src/components/Agent.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ const Agent: FC<TAgentProps> = ({ capabilitiy }) => {
5353
})
5454

5555
const action = useMemo(() => {
56+
// ToDo: better to use capabilitiy.id?
5657
if (capabilitiy.name === 'news-monitor') return () => navigate('/news-monitor')
5758
}, [capabilitiy, navigate])
5859

5960
const handleChangeStatus = () =>
6061
handleToggleCapability.mutate({
6162
methodName: capabilitiy.isEnabled ? 'disableCapability' : 'enableCapability',
6263
params: {
63-
domain: capabilitiy.domain,
64-
name: capabilitiy.name,
64+
id: capabilitiy.id,
6565
},
6666
})
6767

@@ -108,8 +108,7 @@ const Agent: FC<TAgentProps> = ({ capabilitiy }) => {
108108
handleRemoveCapability.mutate({
109109
methodName: 'removeCapability',
110110
params: {
111-
domain: capabilitiy.domain,
112-
name: capabilitiy.name,
111+
id: capabilitiy.id,
113112
},
114113
})}
115114
>

apps/xen-tg-app/src/components/Capabilities.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ const Capabilities = () => {
157157
</div>
158158
{capabilities?.pages.map((group) =>
159159
group?.items?.map((capabilitiy) => (
160-
<Agent key={capabilitiy.name} capabilitiy={capabilitiy} />
160+
<Agent key={capabilitiy.id} capabilitiy={capabilitiy} />
161161
))
162162
)}
163163
<div ref={sentinelRef} />

apps/xen-tg-app/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ export type Balance = {
2828
}
2929

3030
export type TAgent = {
31+
id: string
3132
name: string
3233
domain: string
3334
title: string | null

0 commit comments

Comments
 (0)