From e37adaff301dc8a60c2d040862f576eddc2e95fc Mon Sep 17 00:00:00 2001 From: DIYgod Date: Wed, 10 May 2023 10:44:24 +0100 Subject: [PATCH] fix: connected_account match error --- src/components/site/SiteFooter.tsx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/components/site/SiteFooter.tsx b/src/components/site/SiteFooter.tsx index 54516cff..5d5edc89 100644 --- a/src/components/site/SiteFooter.tsx +++ b/src/components/site/SiteFooter.tsx @@ -53,8 +53,27 @@ export const SiteFooter: React.FC<{ {site?.metadata?.content?.connected_accounts && (
{site?.metadata?.content?.connected_accounts.map( - (account, index) => { - const match = account.match(/:\/\/account:(.*)@(.*)/) + ( + account: + | string + | { uri: string } + | { identity: string; platform: string } + | any, // Otherwise type check will alarm + index, + ) => { + let match: RegExpMatchArray | null = null + switch (typeof account) { + case "string": + match = account.match(/:\/\/account:(.*)@(.*)/) + break + case "object": + if (account.uri) { + match = account.uri.match(/:\/\/account:(.*)@(.*)/) + } else if (account.identity && account.platform) { + match = ["", account.identity, account.platform] + } + break + } if (match) { return (