Skip to content

Commit

Permalink
Merge pull request #1008 from dev-protocol/fix/fetchpost
Browse files Browse the repository at this point in the history
Fix/fetchpost
  • Loading branch information
KukretiShubham authored Jun 19, 2024
2 parents 22be8f7 + cc56c95 commit 30ebfe8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
7 changes: 7 additions & 0 deletions src/components/Page/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ const handleConnection = async (signer: UndefinedOr<Signer>) => {
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),
Expand All @@ -140,6 +144,7 @@ const handleConnection = async (signer: UndefinedOr<Signer>) => {
}
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(
Expand All @@ -150,10 +155,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<Posts[]>(json.contents)
profiles.value = json.profiles
}
Expand Down

0 comments on commit 30ebfe8

Please sign in to comment.