From 778c119986425e3fd2a5055773b235bb63eb607e Mon Sep 17 00:00:00 2001 From: kkmanos Date: Wed, 8 Jan 2025 12:03:58 +0200 Subject: [PATCH] fix: history display --- src/components/History/HistoryList.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/components/History/HistoryList.js b/src/components/History/HistoryList.js index cd71fa7f..6d351d12 100644 --- a/src/components/History/HistoryList.js +++ b/src/components/History/HistoryList.js @@ -22,7 +22,18 @@ const HistoryList = ({ credentialId = null, history, title = '', limit = null }) }, [history, credentialId, limit]); const handleHistoryItemClick = async (item) => { - setMatchingCredentials(item.presentation.startsWith("b64:") ? JSON.parse(new TextDecoder().decode(fromBase64(item.presentation.replace("b64:", "")))) : [ item.presentation ] ); + const extractPresentations = (item) => { + if (item.presentation.startsWith("b64:") && (new TextDecoder().decode(fromBase64(item.presentation.replace("b64:", "")))).includes("[")) { + return JSON.parse(new TextDecoder().decode(fromBase64(item.presentation.replace("b64:", "")))); + } + else if (item.presentation.startsWith("b64:")) { + return [ new TextDecoder().decode(fromBase64(item.presentation.replace("b64:", ""))) ]; + } + else { + return [ item.presentation ]; + } + } + setMatchingCredentials(extractPresentations(item)); if (screenType === 'mobile') { navigate(`/history/${item.id}`); }