Skip to content

Commit

Permalink
chore: update toast message
Browse files Browse the repository at this point in the history
  • Loading branch information
martines3000 committed Apr 22, 2024
1 parent 3ecdfb9 commit 4d33bee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/dapp/src/components/ShareCredentialModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,13 @@ export const ShareCredentialModal = () => {
try {
const result = await shareResponse.json();

if (!result.presentationId)
throw new Error('Failed to share presentation');
if (!result.presentationId) {
throw new Error(
result.message === 'Invalid presentation'
? 'Invalid presentation'
: 'Failed to share presentation'
);
}

setShareLink(
`${window.location.origin}/app/share-presentation/${result.presentationId}`
Expand All @@ -165,7 +170,10 @@ export const ShareCredentialModal = () => {
setTimeout(() => {
useToastStore.setState({
open: true,
title: t('share-presentation-error'),
title:
(e as Error).message === 'Invalid presentation'
? t('share-error-invalid')
: t('share-presentation-error'),
type: 'error',
loading: false,
link: null,
Expand Down
1 change: 1 addition & 0 deletions packages/dapp/src/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@
"placeholder": "Enter a title for the presentation. This can't be changed later.",
"please-sign-in": "Please sign in to share your credentials",
"selected": "Selected Credentials",
"share-error-invalid": "One or more credentials in the presentation are invalid.",
"share-presentation-error": "Failed to share presentation",
"share-presentation-success": "Successfully shared presentation",
"share-link-description": "Share your credential:",
Expand Down

0 comments on commit 4d33bee

Please sign in to comment.