Skip to content

Commit

Permalink
feat: Query credentials for did
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Healy committed May 20, 2020
1 parent 6801a91 commit a39f956
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/react-graphql/client/src/gql/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const deleteIdentity = gql`
`

export const signCredentialJwt = gql`
mutation signCredentialJwt($data: SignCredentialInput!) {
signCredentialJwt(data: $data) {
mutation signCredentialJwt($data: SignCredentialInput!, $save: Boolean) {
signCredentialJwt(data: $data, save: $save) {
raw
}
}
Expand Down
25 changes: 25 additions & 0 deletions examples/react-graphql/client/src/gql/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,31 @@ export const credential = gql`
}
`

export const credentials = gql`
query credentials($subject: String!) {
credentials(input: { where: [{ column: subject, value: $subject }] }) {
hash
issuanceDate
expirationDate
claims {
type
value
isObj
}
issuer {
did
shortId: shortDid
profileImage: latestClaimValue(type: "profileImage")
}
subject {
did
shortId: shortDid
profileImage: latestClaimValue(type: "profileImage")
}
}
}
`

export const identity = gql`
query identity($did: String!) {
identity(did: $did) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { AppContext } from '../../context/AppProvider'
const Component = () => {
const history = useHistory()
const { url } = useRouteMatch()
const [highlightedIdentity, highlightIdentity] = useState()
const [highlightedIdentity, highlightIdentity] = useState<string>()
const { appState, setDefaultDid } = useContext(AppContext)
const { defaultDid } = appState
const { data: managedIdentitiesData } = useQuery(queries.managedIdentities)
Expand Down
2 changes: 1 addition & 1 deletion examples/react-graphql/client/src/views/Issue/Issue.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ const Component = () => {
type: ['VerifiableCredential'],
credentialSubject,
},
save: true,
},
})
console.log(data)
setSignedVC(data.signCredentialJwt.raw)
} catch (e) {}
}
Expand Down

0 comments on commit a39f956

Please sign in to comment.