File tree Expand file tree Collapse file tree 4 files changed +27
-9
lines changed
apps/dashboard/src/app/nebula-app/(app) Expand file tree Collapse file tree 4 files changed +27
-9
lines changed Original file line number Diff line number Diff line change 11import { redirect } from "next/navigation" ;
22import { loginRedirect } from "../../../../(app)/login/loginRedirect" ;
3- import { getNebulaAuthToken } from "../../../_utils/authToken" ;
3+ import {
4+ getNebulaAuthToken ,
5+ getNebulaAuthTokenWalletAddress ,
6+ } from "../../../_utils/authToken" ;
47import { getSessionById } from "../../api/session" ;
58import { 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"
Original file line number Diff line number Diff line change 11import { loginRedirect } from "../../../(app)/login/loginRedirect" ;
2- import { getNebulaAuthToken } from "../../_utils/authToken" ;
2+ import {
3+ getNebulaAuthToken ,
4+ getNebulaAuthTokenWalletAddress ,
5+ } from "../../_utils/authToken" ;
36import { ChatPageContent } from "../components/ChatPageContent" ;
47
58export 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"
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import { EmptyStateChatPageContent } from "./EmptyStateChatPageContent";
2929
3030export 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 ;
Original file line number Diff line number Diff line change 11import { loginRedirect } from "../../(app)/login/loginRedirect" ;
2- import { getNebulaAuthToken } from "../_utils/authToken" ;
2+ import {
3+ getNebulaAuthToken ,
4+ getNebulaAuthTokenWalletAddress ,
5+ } from "../_utils/authToken" ;
36import { ChatPageContent } from "./components/ChatPageContent" ;
47import { 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"
You can’t perform that action at this time.
0 commit comments