Skip to content

Commit

Permalink
Merge pull request #354 from algorandfoundation/fix-logout-url
Browse files Browse the repository at this point in the history
fix: correct the logout url
  • Loading branch information
neilcampbell authored Nov 27, 2024
2 parents 9c4e919 + 6b5ee13 commit 854ca3f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/features/fund/components/dispenser-api-logged-in.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export function DispenserApiLoggedIn({ networkConfig }: Props) {
<RenderLoadable loadable={loadableActiveWalletAccountSnapshot} fallback={<PageLoader />}>
{(activeWalletAccountSnapshot) => (
<div className="flex flex-col gap-4 overflow-hidden xl:w-1/2">
<DispenserApiUserInfo selectedNetwork={networkConfig.id} />
<DispenserApiUserInfo />
<Accordion type="single" collapsible defaultValue="fund">
<AccordionItem value="fund">
<AccordionTrigger>Fund an existing {networkConfig.name} account</AccordionTrigger>
Expand Down
10 changes: 3 additions & 7 deletions src/features/fund/components/dispenser-api-user-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,16 @@ import { Urls } from '@/routes/urls'
import { useAuth0 } from '@auth0/auth0-react'
import { useCallback } from 'react'

type Props = {
selectedNetwork: string
}

export function DispenserApiUserInfo({ selectedNetwork }: Props) {
export function DispenserApiUserInfo() {
const { isAuthenticated, user, logout } = useAuth0()

const logOut = useCallback(async () => {
await logout({
logoutParams: {
returnTo: `${window.location.origin}${Urls.Network.Fund.build({ networkId: selectedNetwork })}`,
returnTo: `${window.location.origin}${Urls.Network.Fund.build({ networkId: '_' })}`,
},
})
}, [logout, selectedNetwork])
}, [logout])

if (!isAuthenticated) {
return undefined
Expand Down
2 changes: 1 addition & 1 deletion src/features/fund/fund-error-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function FundErrorPage() {
<>
<PageTitle title={fundPageTitle} />
<div>
{networkConfig.dispenserApi && <DispenserApiUserInfo selectedNetwork={networkConfig.id} />}
{networkConfig.dispenserApi && <DispenserApiUserInfo />}
<p>Error: {error.message}</p>
</div>
</>
Expand Down

0 comments on commit 854ca3f

Please sign in to comment.