Skip to content

Commit

Permalink
Update ViewBarCode.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
daoauth committed Oct 23, 2024
1 parent dbcb530 commit b908f16
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/holder/src/component/ViewBarCode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,18 @@ export const ViewBarCode = ({ didDoc }: { didDoc: DIDResolutionResult }) => {
const jwt = await walrusDID.signJWT(didDoc.didDocument.id, {
walrus: { code: inputValue },
});
setQRValue(jwt);
try {
if(isNFC && ('NDEFReader' in window)) {
const ndef = new (window as any).NDEFReader();
await ndef.write(jwt);
} else {
setQRValue(jwt);
}
} catch (error) {
enqueueSnackbar(`${error}`, {
variant: 'error',
});
}
}
}
} catch (error) {
Expand Down Expand Up @@ -120,7 +131,7 @@ export const ViewBarCode = ({ didDoc }: { didDoc: DIDResolutionResult }) => {
disabled={isLoading || !inputValue}
onClick={handleSync}
>
{isNFC ? 'NFC' : 'Generate'}
Ready
</Button>
</Stack>
)}
Expand Down

0 comments on commit b908f16

Please sign in to comment.