Revert "Removed some of the calls to process.env; Used server props instead"
This reverts commit f51f36a411
.
This commit is contained in:
parent
f51f36a411
commit
73bf7f3d79
5 changed files with 11 additions and 52 deletions
|
@ -1,31 +1,7 @@
|
|||
import ChatWindow from '@/components/ChatWindow';
|
||||
import { FC } from 'react';
|
||||
import process from 'process';
|
||||
import { GetServerSideProps } from 'next';
|
||||
|
||||
interface PageProps {
|
||||
backendApiUrl: string;
|
||||
params: {
|
||||
chatId: string;
|
||||
};
|
||||
}
|
||||
|
||||
export async function getServerSideProps(context): GetServerSideProps<PageProps> {
|
||||
const backendApiUrl = process.env.BACKEND_API_URL;
|
||||
const { chatId } = context.params || {};
|
||||
|
||||
return {
|
||||
props: {
|
||||
backendApiUrl,
|
||||
params: {
|
||||
chatId: chatId || '',
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const Page: FC<PageProps> = ({ params, backendApiUrl }) => {
|
||||
return <ChatWindow id={params.chatId} backendApiUrl={backendApiUrl} />;
|
||||
const Page = ({ params }: { params: { chatId: string } }) => {
|
||||
return <ChatWindow id={params.chatId} />;
|
||||
};
|
||||
|
||||
export default Page;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue