mirror of
https://github.com/fosrl/pangolin.git
synced 2026-03-01 16:26:39 +00:00
Fix bad request in non-enterprise
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
import ThemeSwitcher from "@app/components/ThemeSwitcher";
|
import ThemeSwitcher from "@app/components/ThemeSwitcher";
|
||||||
import { Separator } from "@app/components/ui/separator";
|
import { Separator } from "@app/components/ui/separator";
|
||||||
import { priv } from "@app/lib/api";
|
import { priv } from "@app/lib/api";
|
||||||
import { verifySession } from "@app/lib/auth/verifySession";
|
|
||||||
import { pullEnv } from "@app/lib/pullEnv";
|
import { pullEnv } from "@app/lib/pullEnv";
|
||||||
|
import { build } from "@server/build";
|
||||||
import { GetLicenseStatusResponse } from "@server/routers/license/types";
|
import { GetLicenseStatusResponse } from "@server/routers/license/types";
|
||||||
import { AxiosResponse } from "axios";
|
import { AxiosResponse } from "axios";
|
||||||
import { Metadata } from "next";
|
import { Metadata } from "next";
|
||||||
@@ -19,19 +19,25 @@ type AuthLayoutProps = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export default async function AuthLayout({ children }: AuthLayoutProps) {
|
export default async function AuthLayout({ children }: AuthLayoutProps) {
|
||||||
const getUser = cache(verifySession);
|
|
||||||
const env = pullEnv();
|
const env = pullEnv();
|
||||||
const user = await getUser();
|
|
||||||
const t = await getTranslations();
|
const t = await getTranslations();
|
||||||
const hideFooter = env.branding.hideAuthLayoutFooter || false;
|
let hideFooter = false;
|
||||||
|
|
||||||
const licenseStatusRes = await cache(
|
if (build == "enterprise") {
|
||||||
async () =>
|
const licenseStatusRes = await cache(
|
||||||
await priv.get<AxiosResponse<GetLicenseStatusResponse>>(
|
async () =>
|
||||||
"/license/status"
|
await priv.get<AxiosResponse<GetLicenseStatusResponse>>(
|
||||||
)
|
"/license/status"
|
||||||
)();
|
)
|
||||||
const licenseStatus = licenseStatusRes.data.data;
|
)();
|
||||||
|
if (
|
||||||
|
env.branding.hideAuthLayoutFooter &&
|
||||||
|
licenseStatusRes.data.data.isHostLicensed &&
|
||||||
|
licenseStatusRes.data.data.isLicenseValid
|
||||||
|
) {
|
||||||
|
hideFooter = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="h-full flex flex-col">
|
<div className="h-full flex flex-col">
|
||||||
@@ -43,10 +49,7 @@ export default async function AuthLayout({ children }: AuthLayoutProps) {
|
|||||||
<div className="w-full max-w-md p-3">{children}</div>
|
<div className="w-full max-w-md p-3">{children}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!(
|
{!hideFooter && (
|
||||||
hideFooter ||
|
|
||||||
(licenseStatus.isHostLicensed && licenseStatus.isLicenseValid)
|
|
||||||
) && (
|
|
||||||
<footer className="hidden md:block w-full mt-12 py-3 mb-6 px-4">
|
<footer className="hidden md:block w-full mt-12 py-3 mb-6 px-4">
|
||||||
<div className="container mx-auto flex flex-wrap justify-center items-center h-3 space-x-4 text-xs text-neutral-400 dark:text-neutral-600">
|
<div className="container mx-auto flex flex-wrap justify-center items-center h-3 space-x-4 text-xs text-neutral-400 dark:text-neutral-600">
|
||||||
<a
|
<a
|
||||||
|
|||||||
Reference in New Issue
Block a user