Skip to content

Commit

Permalink
feat: Set default did as first
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Healy committed Jan 24, 2020
1 parent f537372 commit cc9332c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/react-graphql/client/src/layout/NavigationLeft.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { NavLink } from 'react-router-dom'
const Component = () => {
return (
<Box p={3} width={220} bg="#28292B" borderRight={1} borderColor={'#4B4B4B'}>
<Box mb={32}>
<Box mb={32} pt={2}>
<Heading as={'h3'}>Daf Dashboard</Heading>
<Text>Description</Text>
{/* <Text>DID management and credential portal</Text> */}
</Box>
<ul className={'left-nav-list'}>
<li className={'left-nav-item'}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const Component = () => {
const history = useHistory()
const { url } = useRouteMatch()
const [highlightedIdentity, highlightIdentity] = useState()
const [appState] = useContext(AppContext)
const [appState, setDefaultDid] = useContext(AppContext)
const { defaultDid } = appState
const { data: managedIdentitiesData } = useQuery(queries.managedIdentities)
const [createIdentity] = useMutation(queries.createIdentity, {
Expand All @@ -26,9 +26,11 @@ const Component = () => {

console.log(appState)

// useEffect(() => {
// highlightIdentity(null)
// }, [])
useEffect(() => {
if (!defaultDid && managedIdentitiesData?.managedIdentities?.length > 0) {
setDefaultDid(managedIdentitiesData.managedIdentities[0].did)
}
}, [managedIdentitiesData])

return (
<Page title={'Identity Manger'}>
Expand Down Expand Up @@ -58,8 +60,6 @@ const Component = () => {
<tbody>
{managedIdentitiesData?.managedIdentities?.map(
(identity: { did: string; type: string; shortId: string; name: string }) => {
console.log(identity)

return (
<tr
key={identity.did}
Expand Down

0 comments on commit cc9332c

Please sign in to comment.