From 2688995e6f72bead42a1590a499439d569a7be3a Mon Sep 17 00:00:00 2001 From: Mohammed-Mamoun98 Date: Tue, 3 Dec 2024 12:04:56 +0200 Subject: [PATCH] remove credentials V1 fallbacks --- .../routes/dashboard/credentials/index.tsx | 13 ++++------ examples/idos-example-dapp/src/main.js | 25 +------------------ examples/issuer-sdk-demo/src/app/page.tsx | 13 ++++------ 3 files changed, 11 insertions(+), 40 deletions(-) diff --git a/apps/idos-data-dashboard/src/routes/dashboard/credentials/index.tsx b/apps/idos-data-dashboard/src/routes/dashboard/credentials/index.tsx index e13f214df..c1abdca22 100644 --- a/apps/idos-data-dashboard/src/routes/dashboard/credentials/index.tsx +++ b/apps/idos-data-dashboard/src/routes/dashboard/credentials/index.tsx @@ -42,17 +42,14 @@ const useFetchCredentials = () => { .filter((credential) => !credential.original_id) .map((credential) => { - const { credential_level, credential_status, credential_type, issuer } = - // biome-ignore lint/suspicious/noExplicitAny: // @todo: remove once we have successfully migrated to Credentials 2.0. - credential as any; const fields = credential.public_notes ? JSON.parse(credential.public_notes) : {}; const public_notes = { - id: fields.id ?? credential.id, - level: fields.level ?? credential_level, - status: fields.status ?? credential_status, - type: fields.type ?? credential_type, - issuer: fields.issuer ?? issuer, + id: fields.id, + level: fields.level, + status: fields.status, + type: fields.type, + issuer: fields.issuer, }; return { diff --git a/examples/idos-example-dapp/src/main.js b/examples/idos-example-dapp/src/main.js index eeca74685..d0ddc5e3e 100644 --- a/examples/idos-example-dapp/src/main.js +++ b/examples/idos-example-dapp/src/main.js @@ -200,30 +200,7 @@ const connectWallet = { let credentials = await terminal .h1("eyes", "User's credentials") .wait("awaiting signature", cache.get("credentials") || idos.data.list("credentials")); - credentials = credentials - .filter((c) => c.original_id === null) - // @todo: remove once we have successfully migrated to Credentials 2.0. - .map((credential) => { - const { credential_level, credential_status, credential_type, issuer } = credential; - const _fields = credential.public_notes - ? typeof credential.public_notes === "string" - ? JSON.parse(credential.public_notes) - : credential.public_notes - : {}; - const { id, ...public_notes } = { - id: _fields.id ?? credential.id, - level: _fields.level ?? credential_level, - status: _fields.status ?? credential_status, - type: _fields.type ?? credential_type, - issuer: _fields.issuer ?? issuer, - }; - - return { - ...credential, - ...public_notes, - public_notes, - }; - }); + credentials = credentials.filter((c) => c.original_id === null); cache.set("credentials", credentials); diff --git a/examples/issuer-sdk-demo/src/app/page.tsx b/examples/issuer-sdk-demo/src/app/page.tsx index 48311b50c..342f0f968 100644 --- a/examples/issuer-sdk-demo/src/app/page.tsx +++ b/examples/issuer-sdk-demo/src/app/page.tsx @@ -60,17 +60,14 @@ export default function Home() { const _credentials = await _instance.data.list("credentials"); setCredentials( _credentials.map((credential) => { - const { credential_level, credential_status, credential_type, issuer } = - // biome-ignore lint/suspicious/noExplicitAny: // @todo: remove once we have successfully migrated to Credentials 2.0. - credential as any; const fields = credential.public_notes ? JSON.parse(credential.public_notes) : {}; const public_notes = { - id: fields.id ?? credential.id, - level: fields.level ?? credential_level, - status: fields.status ?? credential_status, - type: fields.type ?? credential_type, - issuer: fields.issuer ?? issuer, + id: fields.id, + level: fields.level, + status: fields.status, + type: fields.type, + issuer: fields.issuer, }; return { ...credential,