-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1913 from dedis/work-fe1-ljankoschek-LinkedOrgAut…
…hFix Work fe1 ljankoschek linked org authentication additions and data exchange
- Loading branch information
Showing
37 changed files
with
1,126 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
fe1-web/src/features/linked-organizations/components/BroadcastLinkedOrgInfo.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import React from 'react'; | ||
import { useToast } from 'react-native-toast-notifications'; | ||
|
||
import { Hash } from 'core/objects'; | ||
import { FOUR_SECONDS } from 'resources/const'; | ||
|
||
import { LinkedOrganizationsHooks } from '../hooks'; | ||
import { tokensExchange } from '../network'; | ||
|
||
interface BroadcastLinkedOrgInfoProps { | ||
linkedLaoId: Hash; | ||
} | ||
|
||
const BroadcastLinkedOrgInfo: React.FC<BroadcastLinkedOrgInfoProps> = ({ linkedLaoId }) => { | ||
const laoId = LinkedOrganizationsHooks.useCurrentLaoId(); | ||
const toast = useToast(); | ||
const fetchedLao = LinkedOrganizationsHooks.useGetLaoById(linkedLaoId); | ||
const fetchedRollCall = LinkedOrganizationsHooks.useGetRollCallById( | ||
fetchedLao!.last_roll_call_id!, | ||
); | ||
|
||
if (fetchedRollCall === undefined) { | ||
toast.show(`Data Exchange failed: RollCall ID is undefined`, { | ||
type: 'danger', | ||
placement: 'bottom', | ||
duration: FOUR_SECONDS, | ||
}); | ||
return null; | ||
} | ||
if (fetchedRollCall.attendees === undefined) { | ||
toast.show(`Data Exchange failed: RollCall Attendees is undefined`, { | ||
type: 'danger', | ||
placement: 'bottom', | ||
duration: FOUR_SECONDS, | ||
}); | ||
return null; | ||
} | ||
tokensExchange(laoId, linkedLaoId, fetchedRollCall.id, fetchedRollCall.attendees) | ||
.then(() => { | ||
console.log('Data Exchange successfull'); | ||
}) | ||
.catch((err) => { | ||
console.log(err); | ||
toast.show(`Could not exchange Tokens, error: ${err}`, { | ||
type: 'danger', | ||
placement: 'bottom', | ||
duration: FOUR_SECONDS, | ||
}); | ||
}); | ||
return null; | ||
}; | ||
|
||
export default BroadcastLinkedOrgInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.