Skip to content

Commit

Permalink
dashboard route bug (#1051)
Browse files Browse the repository at this point in the history
* updated useEffect in profilePage so router path looks for dashboard path before rerouting

* User balance lookup (#1048)

* display wallet in dash to onboarding whitelist addresses and show bundlr balance in user balances

* formatted

* created and implemented two functions for getting user sol and usdc balance

* updated function name

* refactored usdc ui for balance

* refactored getusdcforpublickey and getsolbalanceforpublickey to return a value instead of setting state in global context

* renamed handlers and getbundlrbalanceforuser

* refactored

* refactored bundlr sol and usdc handler to run only if in admin mode

* renamed admin variable

* refactored solBalance

* refactored balances in markup

* renamed hasAccess

* display upload account space available and refactored box for responsiveness

* fix width issue

* updated dependency in useEffect

* fixed dependency array
  • Loading branch information
ikjudd authored May 12, 2023
1 parent 033f163 commit c7454cb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/web/pages/profiles/[profilePubkey]/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ const ProfilePage = (props) => {
const { profilePubkey, loading } = props
const { wallet } = useContext(Wallet.Context)
const router = useRouter()

const dashboardPath = `/profiles/${wallet.publicKey?.toBase58()}`
const routerPath = router.asPath
useEffect(() => {
if (wallet.connected && profilePubkey === wallet.publicKey?.toBase58()) {
if (routerPath === dashboardPath) {
router.push('/dashboard')
}
}, [wallet, profilePubkey])
}, [routerPath])
return (
<>
<Head>
Expand Down

0 comments on commit c7454cb

Please sign in to comment.