Skip to content
This repository has been archived by the owner on Sep 2, 2024. It is now read-only.

Commit

Permalink
fix: link account not updating alby connection card
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Jun 19, 2024
1 parent 5dbf576 commit ff5af24
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
3 changes: 2 additions & 1 deletion frontend/src/components/SidebarHint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ function SidebarHint() {
if (
albyMe &&
nodeConnectionInfo &&
albyMe?.keysend_pubkey !== nodeConnectionInfo?.pubkey
albyMe?.keysend_pubkey !== nodeConnectionInfo?.pubkey &&
!location.pathname.startsWith("/apps")
) {
return (
<SidebarHintCard
Expand Down
20 changes: 11 additions & 9 deletions frontend/src/components/connections/AlbyConnectionCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,17 @@ function AlbyConnectionCard({ connection }: { connection?: App }) {
</ExternalLink>
</div>
</div>
<div>
<Link
to={`/apps/${connection?.nostrPubkey}`}
className="absolute top-0 right-0"
>
<EditIcon className="w-4 h-4 hidden group-hover:inline text-muted-foreground hover:text-card-foreground" />
</Link>
{connection && <AppCardConnectionInfo connection={connection} />}
</div>
{connection && (
<div>
<Link
to={`/apps/${connection.nostrPubkey}`}
className="absolute top-0 right-0"
>
<EditIcon className="w-4 h-4 hidden group-hover:inline text-muted-foreground hover:text-card-foreground" />
</Link>
<AppCardConnectionInfo connection={connection} />
</div>
)}
</div>
</CardContent>
</Card>
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/hooks/useLinkAccount.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState } from "react";
import { toast } from "src/components/ui/use-toast";
import { useAlbyMe } from "src/hooks/useAlbyMe";
import { useApps } from "src/hooks/useApps";
import { useCSRF } from "src/hooks/useCSRF";
import { useNodeConnectionInfo } from "src/hooks/useNodeConnectionInfo";
import { request } from "src/utils/request";
Expand All @@ -14,6 +15,7 @@ export enum LinkStatus {
export function useLinkAccount() {
const { data: csrf } = useCSRF();
const { data: me, mutate: reloadAlbyMe } = useAlbyMe();
const { mutate: reloadApps } = useApps();
const { data: nodeConnectionInfo } = useNodeConnectionInfo();
const [loading, setLoading] = useState(false);

Expand Down Expand Up @@ -43,7 +45,8 @@ export function useLinkAccount() {
"Content-Type": "application/json",
},
});
await reloadAlbyMe();
// update the link status and get the newly-created Alby Account app
await Promise.all([reloadAlbyMe(), reloadApps()]);
toast({
title:
"Your Alby Hub has successfully been linked to your Alby Account",
Expand Down

0 comments on commit ff5af24

Please sign in to comment.