"use client"; import { useRef } from "react"; import { Client2ConsumerTableConfig, Client2ProducerTableConfig, } from "@/config/client_2"; import CustomTable from "@/components/table"; import useGetEntityByName from "@/components/hooks/useGetEntityById"; import { Button, Card, CardContent, CardHeader, Skeleton, Typography } from "@mui/material"; import CopyToClipboard from "@/components/copy_to_clipboard"; import { useGetEntity } from "@/api/entities/entities"; import { useGetConsumer } from "@/api/consumers/consumers"; import { mutate } from "swr"; import axios from "axios"; import { BASE_URL } from "@/constants"; export default function Client2() { const { entity } = useGetEntityByName('C2'); const { data: client2, isLoading, swrKey: entityKeyFunc } = useGetEntity({ entity_did: entity?.did }) const { data: consumerData, isLoading: loadingConsumerData, swrKey: consumerKeyFunc } = useGetConsumer({ entity_did: entity?.did }) const cardContentRef = useRef(null); const onAttachEntity = async () => { try { const response = await axios.post(`${BASE_URL}/attach`, { entity_did: entity?.did }); alert(response.data.message); } catch (error) { console.error(error); } finally { } } const onDetachEntity = async () => { try { const response = await axios.post(`${BASE_URL}/detach`, { entity_did: entity?.did }); console.log('detach', response) alert('Entity Detached Successfully.'); } catch (error) { console.error(error); } finally { } } const onRefresh = () => { const entityKey = typeof entityKeyFunc === 'function' ? entityKeyFunc() : entityKeyFunc; const consumerKey = typeof consumerKeyFunc === 'function' ? consumerKeyFunc() : consumerKeyFunc; if (entityKey) mutate(entityKey); if (consumerKey) mutate(consumerKey) } if (isLoading) return return (

Client 2

} /> DID: {client2?.data?.did} IP: {client2?.data?.ip} Network: {client2?.data?.other?.network}

Consumer View

Producer View

); }