Skip to content

Commit

Permalink
fix: fixed type error in fetch chat
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausMikhaelson committed Nov 16, 2023
1 parent 1d49e23 commit 153336a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export const ChatViewList: React.FC<IChatViewListProps> = (
{chatFeed &&
account &&
checkIfIntent({
chat: chatFeed,
chat: chatFeed as IFeeds,
account: account!,
}) && (
<ApproveRequestBubble
Expand Down
13 changes: 6 additions & 7 deletions packages/uiweb/src/lib/helpers/chat/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,24 +172,23 @@ export const getDefaultFeedObject = ({
};

type CheckIfIntentType = {
chat: any;
chat: IFeeds;
account: string;
};
export const checkIfIntent = ({
chat,
account,
}: CheckIfIntentType): boolean => {
const ChatObject = chat[0];
if (account) {
if (
Object.keys(ChatObject || {}).length &&
ChatObject.combinedDID
Object.keys(chat || {}).length &&
chat.combinedDID
.toLowerCase()
.includes(walletToPCAIP10(account).toLowerCase())
) {
if (
ChatObject.intent &&
ChatObject.intent
chat.intent &&
chat.intent
.toLowerCase()
.includes(walletToPCAIP10(account).toLowerCase())
)
Expand Down Expand Up @@ -274,4 +273,4 @@ export const checkIfSameChat = (
console.log(chatId);

return false;
};
};
2 changes: 1 addition & 1 deletion packages/uiweb/src/lib/hooks/chat/useFetchChat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const useFetchChat = () => {
console.log("chatss calling in hook before", alias);
const chat = await alias.chat.list("CHATS")
console.log('chatss in hook', chat);
return chat;
return chat[0];
} catch (error: Error | any) {
setLoading(false);
setError(error.message);
Expand Down

0 comments on commit 153336a

Please sign in to comment.