From a39f9568e2b4ef3e8b0ee62f23c96451ca427cd4 Mon Sep 17 00:00:00 2001 From: Jason Healy Date: Wed, 20 May 2020 13:45:14 +0100 Subject: [PATCH] feat: Query credentials for did --- .../react-graphql/client/src/gql/mutations.ts | 4 +-- .../react-graphql/client/src/gql/queries.ts | 25 +++++++++++++++++++ .../src/views/Identity/IdentitiyManager.tsx | 2 +- .../client/src/views/Issue/Issue.tsx | 2 +- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/examples/react-graphql/client/src/gql/mutations.ts b/examples/react-graphql/client/src/gql/mutations.ts index d60e962d5..d2f87d169 100644 --- a/examples/react-graphql/client/src/gql/mutations.ts +++ b/examples/react-graphql/client/src/gql/mutations.ts @@ -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 } } diff --git a/examples/react-graphql/client/src/gql/queries.ts b/examples/react-graphql/client/src/gql/queries.ts index 28a9b01e0..687f67de4 100644 --- a/examples/react-graphql/client/src/gql/queries.ts +++ b/examples/react-graphql/client/src/gql/queries.ts @@ -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) { diff --git a/examples/react-graphql/client/src/views/Identity/IdentitiyManager.tsx b/examples/react-graphql/client/src/views/Identity/IdentitiyManager.tsx index 4eb38cadf..3bf3fd07d 100644 --- a/examples/react-graphql/client/src/views/Identity/IdentitiyManager.tsx +++ b/examples/react-graphql/client/src/views/Identity/IdentitiyManager.tsx @@ -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() const { appState, setDefaultDid } = useContext(AppContext) const { defaultDid } = appState const { data: managedIdentitiesData } = useQuery(queries.managedIdentities) diff --git a/examples/react-graphql/client/src/views/Issue/Issue.tsx b/examples/react-graphql/client/src/views/Issue/Issue.tsx index 2c1e31780..4ee8bb7f4 100644 --- a/examples/react-graphql/client/src/views/Issue/Issue.tsx +++ b/examples/react-graphql/client/src/views/Issue/Issue.tsx @@ -46,9 +46,9 @@ const Component = () => { type: ['VerifiableCredential'], credentialSubject, }, + save: true, }, }) - console.log(data) setSignedVC(data.signCredentialJwt.raw) } catch (e) {} }