Skip to content

Commit

Permalink
feat(dashboard): add eas attestations credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
waddaboo committed Oct 2, 2024
1 parent ff796cb commit 6d14810
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion apps/dashboard/src/pages/credentials.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
blockchain,
Web2Provider,
twitter,
github
github,
eas
} from "@bandada/credentials"
import { Flex, Text, Button } from "@chakra-ui/react"
import { useEffect, useState, useCallback, useContext } from "react"
Expand Down Expand Up @@ -227,6 +228,57 @@ export default function CredentialsPage() {
}
}

// If the credential is EAS
if (
providerName === eas.name &&
isLoggedInAdmin() &&
state &&
admin
) {
if (groupType) {
const bandadaCredentials =
localStorage.getItem(LOCAL_STORAGE)
if (!bandadaCredentials) return null
const providers = JSON.parse(bandadaCredentials)
providers[providerName] = [
state,
undefined,
admin.address
]
localStorage.setItem(
LOCAL_STORAGE,
JSON.stringify(providers)
)
if (!groupId || !memberId) return
const url = getUrlNextEmpty(groupId, memberId)

if (url === null) {
const clientRedirectUrl =
await validateCredentials()
if (clientRedirectUrl) {
window.location.replace(clientRedirectUrl)
} else {
setMessage("You have joined the group!")
}
return
}

window.location.replace(url)
}

const redirectUrl = await addMemberByCredentials(
[state],
undefined,
[admin.address]
)

if (redirectUrl) {
window.location.replace(redirectUrl)
} else {
setMessage("You have joined the group!")
}
}

// If it is a web2 credential. This is the first request for web2 credentials
if (
(providerName === twitter.name ||
Expand Down

0 comments on commit 6d14810

Please sign in to comment.