Skip to content

Commit 715b921

Browse files
committed
Nebula: Fix wallet address not set when clicking example prompt on login page
1 parent 3825563 commit 715b921

File tree

4 files changed

+27
-9
lines changed

4 files changed

+27
-9
lines changed

apps/dashboard/src/app/nebula-app/(app)/chat/[session_id]/page.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { redirect } from "next/navigation";
22
import { loginRedirect } from "../../../../(app)/login/loginRedirect";
3-
import { getNebulaAuthToken } from "../../../_utils/authToken";
3+
import {
4+
getNebulaAuthToken,
5+
getNebulaAuthTokenWalletAddress,
6+
} from "../../../_utils/authToken";
47
import { getSessionById } from "../../api/session";
58
import { ChatPageContent } from "../../components/ChatPageContent";
69

@@ -12,8 +15,9 @@ export default async function Page(props: {
1215
const params = await props.params;
1316
const pagePath = `/chat/${params.session_id}`;
1417
const authToken = await getNebulaAuthToken();
18+
const accountAddress = await getNebulaAuthTokenWalletAddress();
1519

16-
if (!authToken) {
20+
if (!authToken || !accountAddress) {
1721
loginRedirect(pagePath);
1822
}
1923

@@ -28,6 +32,7 @@ export default async function Page(props: {
2832

2933
return (
3034
<ChatPageContent
35+
accountAddress={accountAddress}
3136
authToken={authToken}
3237
session={session}
3338
type="new-chat"

apps/dashboard/src/app/nebula-app/(app)/chat/page.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
import { loginRedirect } from "../../../(app)/login/loginRedirect";
2-
import { getNebulaAuthToken } from "../../_utils/authToken";
2+
import {
3+
getNebulaAuthToken,
4+
getNebulaAuthTokenWalletAddress,
5+
} from "../../_utils/authToken";
36
import { ChatPageContent } from "../components/ChatPageContent";
47

58
export default async function Page() {
6-
const authToken = await getNebulaAuthToken();
9+
const [authToken, accountAddress] = await Promise.all([
10+
getNebulaAuthToken(),
11+
getNebulaAuthTokenWalletAddress(),
12+
]);
713

8-
if (!authToken) {
14+
if (!authToken || !accountAddress) {
915
loginRedirect();
1016
}
1117

1218
return (
1319
<ChatPageContent
20+
accountAddress={accountAddress}
1421
authToken={authToken}
1522
session={undefined}
1623
type="new-chat"

apps/dashboard/src/app/nebula-app/(app)/components/ChatPageContent.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ import { EmptyStateChatPageContent } from "./EmptyStateChatPageContent";
2929

3030
export function ChatPageContent(props: {
3131
session: SessionInfo | undefined;
32+
accountAddress: string;
3233
authToken: string;
3334
type: "landing" | "new-chat";
3435
initialParams:
@@ -99,7 +100,7 @@ export function ChatPageContent(props: {
99100
contextRes?.chain_ids ||
100101
props.initialParams?.chainIds.map((x) => x.toString()) ||
101102
[],
102-
walletAddress: contextRes?.wallet_address || null,
103+
walletAddress: contextRes?.wallet_address || props.accountAddress || null,
103104
};
104105

105106
return value;

apps/dashboard/src/app/nebula-app/(app)/page.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { loginRedirect } from "../../(app)/login/loginRedirect";
2-
import { getNebulaAuthToken } from "../_utils/authToken";
2+
import {
3+
getNebulaAuthToken,
4+
getNebulaAuthTokenWalletAddress,
5+
} from "../_utils/authToken";
36
import { ChatPageContent } from "./components/ChatPageContent";
47
import { getChains } from "./utils/getChainIds";
58

@@ -11,17 +14,19 @@ export default async function Page(props: {
1114
}) {
1215
const searchParams = await props.searchParams;
1316

14-
const [chains, authToken] = await Promise.all([
17+
const [chains, authToken, accountAddress] = await Promise.all([
1518
getChains(searchParams.chain),
1619
getNebulaAuthToken(),
20+
getNebulaAuthTokenWalletAddress(),
1721
]);
1822

19-
if (!authToken) {
23+
if (!authToken || !accountAddress) {
2024
loginRedirect();
2125
}
2226

2327
return (
2428
<ChatPageContent
29+
accountAddress={accountAddress}
2530
authToken={authToken}
2631
session={undefined}
2732
type="landing"

0 commit comments

Comments
 (0)