Let's try this one out now
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
import { Html, Head, Main, NextScript } from 'next/document'
|
||||
/* eslint-disable @next/next/no-sync-scripts */
|
||||
import {Html, Head, Main, NextScript} from "next/document";
|
||||
|
||||
export default function Document() {
|
||||
return (
|
||||
<Html lang="en">
|
||||
<Head />
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
)
|
||||
return (
|
||||
<Html lang="en">
|
||||
<Head>
|
||||
<script src="/__ENV.js" />
|
||||
</Head>
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import AdminDashboard from "@/dashboards/Admin";
|
||||
import CorporateDashboard from "@/dashboards/Corporate";
|
||||
import TeacherDashboard from "@/dashboards/Teacher";
|
||||
import AgentDashboard from "@/dashboards/Agent";
|
||||
import {env} from "@/utils";
|
||||
|
||||
export const getServerSideProps = withIronSessionSsr(({req, res}) => {
|
||||
const user = req.session.user;
|
||||
@@ -53,7 +54,7 @@ export default function Home() {
|
||||
const {user, mutateUser} = useUser({redirectTo: "/login"});
|
||||
|
||||
useEffect(() => {
|
||||
console.log({env: process.env.NEXT_PUBLIC_TEST});
|
||||
console.log({env: env("NEXT_PUBLIC_TEST")});
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -8,3 +8,7 @@ export function dateSorter(a: any, b: any, direction: "asc" | "desc", key: strin
|
||||
if (moment(b[key]).isAfter(a[key])) return direction === "asc" ? 1 : -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
export function env(key: string) {
|
||||
return (window as any).__ENV[key];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user