From c7d0a78964f54c7bf50f0e261948cc333e160fd6 Mon Sep 17 00:00:00 2001 From: Shubham Kukreti <57281769+KukretiShubham@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:13:55 +0530 Subject: [PATCH 1/2] wip: fix fetchpost --- package.json | 2 +- src/components/Page/Index.vue | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index fe4ba0c6..86c3cb1e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@devprotocol/clubs-plugin-posts", - "version": "0.20.13", + "version": "0.20.14-beta.0", "type": "module", "description": "Template repository for using TypeScript", "main": "dist/index.js", diff --git a/src/components/Page/Index.vue b/src/components/Page/Index.vue index 98568b14..aea96100 100644 --- a/src/components/Page/Index.vue +++ b/src/components/Page/Index.vue @@ -132,6 +132,10 @@ const handleConnection = async (signer: UndefinedOr) => { walletAddress.value = connectedAddress if (isVerified.value) { + const walletAddres = (await walletSigner?.getAddress()) as string + const hash = getMessage(walletAddres) + let sig = await getSignature(walletAddres, walletSigner as Signer) + fetchPosts({ hash, sig }) hasEditableRole.value = await testPermission( walletAddress.value, new JsonRpcProvider(props.rpcUrl), @@ -140,6 +144,8 @@ const handleConnection = async (signer: UndefinedOr) => { } const fetchPosts = async ({ hash, sig }: { hash?: string; sig?: string }) => { + + console.log('fetching posts') const query = hash && sig ? new URLSearchParams({ hash, sig }) : new URLSearchParams() const url = new URL( @@ -150,10 +156,12 @@ const fetchPosts = async ({ hash, sig }: { hash?: string; sig?: string }) => { fetch(url.toString()) .then(async (res) => { if (res.status === 200) { + console.log('post success') const json = (await res.json()) as { contents: string profiles: { [address: string]: ClubsProfile | undefined } } + console.log({json}) posts.value = decode(json.contents) profiles.value = json.profiles } From cc56c95b2fdd4732d9059f6d7bc00120150752e6 Mon Sep 17 00:00:00 2001 From: Shubham Kukreti <57281769+KukretiShubham@users.noreply.github.com> Date: Wed, 12 Jun 2024 16:14:14 +0530 Subject: [PATCH 2/2] lint --- src/components/Page/Index.vue | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/Page/Index.vue b/src/components/Page/Index.vue index aea96100..3037cd0e 100644 --- a/src/components/Page/Index.vue +++ b/src/components/Page/Index.vue @@ -144,7 +144,6 @@ const handleConnection = async (signer: UndefinedOr) => { } const fetchPosts = async ({ hash, sig }: { hash?: string; sig?: string }) => { - console.log('fetching posts') const query = hash && sig ? new URLSearchParams({ hash, sig }) : new URLSearchParams() @@ -161,7 +160,7 @@ const fetchPosts = async ({ hash, sig }: { hash?: string; sig?: string }) => { contents: string profiles: { [address: string]: ClubsProfile | undefined } } - console.log({json}) + console.log({ json }) posts.value = decode(json.contents) profiles.value = json.profiles }