From 0319853bc4e028e63a1eb3473fb085e0bc85d750 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Wed, 24 Apr 2024 18:01:58 -0500 Subject: [PATCH] try to send a matrix message --- frontend/src/App.jsx | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 9c6eae7..c444445 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -48,8 +48,6 @@ function App() { const [showAddPost, setShowAddPost] = useState(false); const [showViewPost, setShowViewPost] = useState(false); const [viewPost, setViewPost] = useState({}); - const [widgetId, setWidgetId] = useState(); - const [matrixUserId, setMatrixUserId] = useState(); const widgetApi = useRef(); const web3ProviderValue = useMemo(() => ({ provider, @@ -244,18 +242,11 @@ function App() { /* -------------------------------------------------------------------------------- */ useEffect(() => { - const params = new URL(document.location).searchParams; - console.log('params', params.toString()); - setWidgetId(params.get('widgetId')); - setMatrixUserId(params.get('userId')); + widgetApi.current = new WidgetApi(); + // const api = widgetApi.current; + // api.requestCapability(MatrixCapabilities.) }, []); - useEffect(() => { - if (widgetId) { - widgetApi.current = new WidgetApi(widgetId); - } - }, [widgetId]); - /* -------------------------------------------------------------------------------- */ /* --------------------------- BEGIN UI ACTIONS ----------------------------------- */ /* -------------------------------------------------------------------------------- */ @@ -340,7 +331,7 @@ function App() { // TODO: Sign and send a message to the forum-api bot / to a room in matrix const registerMatrixIdentity = async () => { - console.log('matrix user id', matrixUserId); + widgetApi.current.send('m.message', 'test message'); }; /* -------------------------------------------------------------------------------- */ @@ -394,11 +385,9 @@ function App() {
- {!!widgetId && ( - - )} +