From a439a375f3df8db9a4e0d4d97784196fc336ec84 Mon Sep 17 00:00:00 2001 From: Adesojisouljay Date: Fri, 15 Nov 2024 00:08:08 +0100 Subject: [PATCH] profile btc refactor --- src/common/api/breakaway.ts | 4 ++-- src/common/components/login/index.tsx | 8 +++----- src/common/components/profile-card/index.tsx | 9 +++++---- src/common/components/wallet-bitcoin-machines/index.tsx | 5 +++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/common/api/breakaway.ts b/src/common/api/breakaway.ts index 1486d36db41..5254676267e 100644 --- a/src/common/api/breakaway.ts +++ b/src/common/api/breakaway.ts @@ -1,9 +1,9 @@ import axios, { AxiosResponse } from "axios" import * as ls from "../util/local-storage"; -const baUrl = "http://localhost:4000" +// const baUrl = "http://localhost:4000" // const baUrl = "https://breakaway-points-system-api.onrender.com" -// const baUrl = "https://api.breakaway.community" +const baUrl = "https://api.breakaway.community" const accessToken = ls.get("ba_access_token") export const createBreakawayUser = async (username: string, community: string, referral: string, email: string)=> { diff --git a/src/common/components/login/index.tsx b/src/common/components/login/index.tsx index 2167715378e..ad21e0c0ef3 100644 --- a/src/common/components/login/index.tsx +++ b/src/common/components/login/index.tsx @@ -111,13 +111,11 @@ export class LoginKc extends BaseComponent { this.stateSet({ inProgress: true }); - let btcAddress; - try { - const baUser = await getUserByUsername(username) - + // if((this.props.global.hive_id === "hive-125568" || this.props.global.hive_id === "hive-159314" )) { - // if(baUser?.bacUser?.bitcoinAddress) { + // if(baUser?.bacUser?.bitcoinAddress) { + // const baUser = await getUserByUsername(username) // btcAddress = baUser?.bacUser?.bitcoinAddress // const addressBalance = await getBtcWalletBalance(baUser?.bacUser?.bitcoinAddress); // if(addressBalance.balance > 0.0005) { diff --git a/src/common/components/profile-card/index.tsx b/src/common/components/profile-card/index.tsx index d67b188711c..3ca70473082 100644 --- a/src/common/components/profile-card/index.tsx +++ b/src/common/components/profile-card/index.tsx @@ -45,7 +45,7 @@ interface Props { global: Global; history: History; activeUser: ActiveUser | any; - account: Account; + account: Account | any; section?: string; addAccount: (data: Account) => void; updateActiveUser: (data?: Account) => void; @@ -109,8 +109,9 @@ export const ProfileCard = (props: Props) => { useEffect(() => { const getMetaData = () => { + console.log(account) try { - const metaData = JSON.parse(activeUser?.data?.posting_json_metadata); + const metaData = JSON.parse(account?.posting_json_metadata); setJsonMetaData(metaData) } catch (error) { console.log(error) @@ -207,7 +208,7 @@ export const ProfileCard = (props: Props) => { { ((global?.communityTitle === "Bitcoin Machines" && global?.hive_id === "hive-159314") || global?.hive_id === "hive-125568") && -
+ (jsonMetaData?.bitcoin ?
BTC info
Address: @@ -225,7 +226,7 @@ export const ProfileCard = (props: Props) => { Signature: {formatString(jsonMetaData?.bitcoin.signature)}
-
} +
: <>) } {loggedIn && !isMyProfile &&
diff --git a/src/common/components/wallet-bitcoin-machines/index.tsx b/src/common/components/wallet-bitcoin-machines/index.tsx index c07cdb6206c..d2eaf5b79f4 100644 --- a/src/common/components/wallet-bitcoin-machines/index.tsx +++ b/src/common/components/wallet-bitcoin-machines/index.tsx @@ -102,7 +102,7 @@ interface Props { dynamicProps: DynamicProps; history: History; activeUser: ActiveUser | any; - account: Account; + account: Account | any; points: Points; signingKey: string; transactions: Transactions; @@ -142,7 +142,8 @@ export const WalletBtc = (props: Props) => { useEffect(() => { const getMetaData = () => { try { - const metaData = JSON.parse(activeUser?.data?.posting_json_metadata); + ///account + const metaData = JSON.parse(account?.posting_json_metadata); setJsonMetaData(metaData) } catch (error) { console.log(error)