Skip to content

Commit 30ebfe8

Browse files
Merge pull request #1008 from dev-protocol/fix/fetchpost
Fix/fetchpost
2 parents 22be8f7 + cc56c95 commit 30ebfe8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@devprotocol/clubs-plugin-posts",
3-
"version": "0.20.13",
3+
"version": "0.20.14-beta.0",
44
"type": "module",
55
"description": "Template repository for using TypeScript",
66
"main": "dist/index.js",

src/components/Page/Index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ const handleConnection = async (signer: UndefinedOr<Signer>) => {
132132
walletAddress.value = connectedAddress
133133
134134
if (isVerified.value) {
135+
const walletAddres = (await walletSigner?.getAddress()) as string
136+
const hash = getMessage(walletAddres)
137+
let sig = await getSignature(walletAddres, walletSigner as Signer)
138+
fetchPosts({ hash, sig })
135139
hasEditableRole.value = await testPermission(
136140
walletAddress.value,
137141
new JsonRpcProvider(props.rpcUrl),
@@ -140,6 +144,7 @@ const handleConnection = async (signer: UndefinedOr<Signer>) => {
140144
}
141145
142146
const fetchPosts = async ({ hash, sig }: { hash?: string; sig?: string }) => {
147+
console.log('fetching posts')
143148
const query =
144149
hash && sig ? new URLSearchParams({ hash, sig }) : new URLSearchParams()
145150
const url = new URL(
@@ -150,10 +155,12 @@ const fetchPosts = async ({ hash, sig }: { hash?: string; sig?: string }) => {
150155
fetch(url.toString())
151156
.then(async (res) => {
152157
if (res.status === 200) {
158+
console.log('post success')
153159
const json = (await res.json()) as {
154160
contents: string
155161
profiles: { [address: string]: ClubsProfile | undefined }
156162
}
163+
console.log({ json })
157164
posts.value = decode<Posts[]>(json.contents)
158165
profiles.value = json.profiles
159166
}

0 commit comments

Comments
 (0)