mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-10 20:02:26 +00:00
Fix api call
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { Metadata } from "next";
|
||||
import { headers } from "next/headers";
|
||||
import { priv } from "@app/lib/api";
|
||||
import { GetMaintenanceInfoResponse } from "@server/routers/resource/types";
|
||||
@@ -10,9 +11,14 @@ import {
|
||||
} from "@app/components/ui/card";
|
||||
import { Alert, AlertTitle, AlertDescription } from "@app/components/ui/alert";
|
||||
import { Clock } from "lucide-react";
|
||||
import { AxiosResponse } from "axios";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Maintenance"
|
||||
};
|
||||
|
||||
export default async function MaintenanceScreen() {
|
||||
const t = await getTranslations();
|
||||
|
||||
@@ -25,12 +31,12 @@ export default async function MaintenanceScreen() {
|
||||
const host = headersList.get("host") || "";
|
||||
const hostname = host.split(":")[0];
|
||||
|
||||
const res = await priv.get<GetMaintenanceInfoResponse>(
|
||||
const res = await priv.get<AxiosResponse<GetMaintenanceInfoResponse>>(
|
||||
`/maintenance/info?fullDomain=${encodeURIComponent(hostname)}`
|
||||
);
|
||||
|
||||
if (res && res.status === 200) {
|
||||
const maintenanceInfo = res.data;
|
||||
const maintenanceInfo = res.data.data;
|
||||
title = maintenanceInfo?.maintenanceTitle || title;
|
||||
message = maintenanceInfo?.maintenanceMessage || message;
|
||||
estimatedTime = maintenanceInfo?.maintenanceEstimatedTime || null;
|
||||
|
||||
Reference in New Issue
Block a user