Skip to content

Commit c7d0a78

Browse files
wip: fix fetchpost
1 parent 0614f80 commit c7d0a78

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-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: 8 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,8 @@ const handleConnection = async (signer: UndefinedOr<Signer>) => {
140144
}
141145
142146
const fetchPosts = async ({ hash, sig }: { hash?: string; sig?: string }) => {
147+
148+
console.log('fetching posts')
143149
const query =
144150
hash && sig ? new URLSearchParams({ hash, sig }) : new URLSearchParams()
145151
const url = new URL(
@@ -150,10 +156,12 @@ const fetchPosts = async ({ hash, sig }: { hash?: string; sig?: string }) => {
150156
fetch(url.toString())
151157
.then(async (res) => {
152158
if (res.status === 200) {
159+
console.log('post success')
153160
const json = (await res.json()) as {
154161
contents: string
155162
profiles: { [address: string]: ClubsProfile | undefined }
156163
}
164+
console.log({json})
157165
posts.value = decode<Posts[]>(json.contents)
158166
profiles.value = json.profiles
159167
}

0 commit comments

Comments
 (0)