From ed00bb23cc87f6ae3f30264e46bd1bd00b192045 Mon Sep 17 00:00:00 2001 From: NickJ202 Date: Fri, 21 Jun 2024 09:46:52 -0400 Subject: [PATCH] catch empty message results --- src/api/index.ts | 2 +- src/api/profiles.ts | 20 ++++++++++++++++++- src/components/organisms/Banner/styles.ts | 3 +-- .../AssetActionMarketOrders.tsx | 4 ++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/api/index.ts b/src/api/index.ts index 7031a4c..817f998 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -316,7 +316,7 @@ export async function messageResults(args: { data: JSON.stringify(args.data), }); - await new Promise((resolve) => setTimeout(resolve, 500)); + await new Promise((resolve) => setTimeout(resolve, 1000)); const messageResults = await results({ process: args.processId, diff --git a/src/api/profiles.ts b/src/api/profiles.ts index 1e002d0..9b374f7 100644 --- a/src/api/profiles.ts +++ b/src/api/profiles.ts @@ -1,7 +1,25 @@ import { readHandler } from 'api'; import { AOS } from 'helpers/config'; -import { ProfileHeaderType, RegistryProfileType } from 'helpers/types'; + +export type AOProfileType = { + id: string; + walletAddress: string; + displayName: string | null; + username: string | null; + bio: string | null; + avatar: string | null; + banner: string | null; +}; + +export type ProfileHeaderType = AOProfileType; + +export type RegistryProfileType = { + id: string; + avatar: string | null; + username: string; + bio?: string; +}; export async function getProfileById(args: { profileId: string }): Promise { const emptyProfile = { diff --git a/src/components/organisms/Banner/styles.ts b/src/components/organisms/Banner/styles.ts index fd5686f..1d93389 100644 --- a/src/components/organisms/Banner/styles.ts +++ b/src/components/organisms/Banner/styles.ts @@ -4,12 +4,11 @@ import { fadeIn1, open } from 'helpers/animations'; export const Wrapper = styled.div` height: 30px; - width 100%; + width: 100%; display: flex; align-items: center; justify-content: center; gap: 20px; - border-top: 1px solid ${(props) => props.theme.colors.border.alt2}; border-bottom: 1px solid ${(props) => props.theme.colors.border.alt2}; background: ${(props) => props.theme.colors.container.alt6.background}; animation: ${open} ${fadeIn1}; diff --git a/src/views/Asset/AssetAction/AssetActionMarket/AssetActionMarketOrders/AssetActionMarketOrders.tsx b/src/views/Asset/AssetAction/AssetActionMarket/AssetActionMarketOrders/AssetActionMarketOrders.tsx index 48493ed..e54a49d 100644 --- a/src/views/Asset/AssetAction/AssetActionMarket/AssetActionMarketOrders/AssetActionMarketOrders.tsx +++ b/src/views/Asset/AssetAction/AssetActionMarket/AssetActionMarketOrders/AssetActionMarketOrders.tsx @@ -240,7 +240,6 @@ export default function AssetActionMarketOrders(props: IProps) { setOrderLoading(true); try { setCurrentNotification('Depositing balance...'); - const response: any = await messageResults({ processId: arProvider.profile.id, action: 'Transfer', @@ -256,7 +255,8 @@ export default function AssetActionMarketOrders(props: IProps) { }); if (response) { - setCurrentNotification(response['Transfer-Success'].message || 'Deposited funds'); + if (response['Transfer-Success']) + setCurrentNotification(response['Transfer-Success'].message || 'Deposited funds'); switch (props.type) { case 'buy': case 'sell':