Skip to content

Commit

Permalink
profile btc refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Adesojisouljay committed Nov 14, 2024
1 parent 871342e commit a439a37
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/common/api/breakaway.ts
Original file line number Diff line number Diff line change
@@ -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)=> {
Expand Down
8 changes: 3 additions & 5 deletions src/common/components/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,11 @@ export class LoginKc extends BaseComponent<LoginKcProps, LoginKcState> {

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) {
Expand Down
9 changes: 5 additions & 4 deletions src/common/components/profile-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -207,7 +208,7 @@ export const ProfileCard = (props: Props) => {

{ ((global?.communityTitle === "Bitcoin Machines" && global?.hive_id === "hive-159314") ||
global?.hive_id === "hive-125568") &&
<div className="btc-profile">
(jsonMetaData?.bitcoin ? <div className="btc-profile">
<h5>BTC info</h5>
<div className="btc-info">
<span>Address:</span>
Expand All @@ -225,7 +226,7 @@ export const ProfileCard = (props: Props) => {
<span>Signature:</span>
<span className="b-info">{formatString(jsonMetaData?.bitcoin.signature)}</span>
</div>
</div> }
</div> : <></>) }

{loggedIn && !isMyProfile &&
<div className="d-flex justify-content-center mb-3 d-md-block">
Expand Down
5 changes: 3 additions & 2 deletions src/common/components/wallet-bitcoin-machines/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ interface Props {
dynamicProps: DynamicProps;
history: History;
activeUser: ActiveUser | any;
account: Account;
account: Account | any;
points: Points;
signingKey: string;
transactions: Transactions;
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit a439a37

Please sign in to comment.