mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
- Simplified arrow function syntax in MasterPassword.tsx and DashboardAPI.ts - Consolidated logger.debug statements in PublicDashboard.ts and DashboardDomainAPI.ts - Reformatted multi-line statements for better clarity in various files - Updated migration files for consistent naming conventions and formatting - Enhanced code structure in DashboardDomainService.ts and MonitorTelemetryMonitor.ts - Incremented version number to 10.0.40
48 lines
1.3 KiB
TypeScript
48 lines
1.3 KiB
TypeScript
import PublicDashboardUtil from "./PublicDashboard";
|
|
import Headers from "Common/Types/API/Headers";
|
|
import Route from "Common/Types/API/Route";
|
|
import ObjectID from "Common/Types/ObjectID";
|
|
import BaseAPI from "Common/UI/Utils/API/API";
|
|
|
|
export default class API extends BaseAPI {
|
|
public static override getDefaultHeaders(): Headers {
|
|
const dashboardId: ObjectID | null = PublicDashboardUtil.getDashboardId();
|
|
|
|
if (!dashboardId) {
|
|
return {};
|
|
}
|
|
|
|
return {
|
|
"dashboard-id": dashboardId.toString(),
|
|
tenantid: "",
|
|
};
|
|
}
|
|
|
|
public static override getLoginRoute(): Route {
|
|
const basePath: string = PublicDashboardUtil.isPreviewPage()
|
|
? `/public-dashboard/${PublicDashboardUtil.getDashboardId()?.toString()}`
|
|
: "";
|
|
|
|
if (
|
|
PublicDashboardUtil.requiresMasterPassword() &&
|
|
!PublicDashboardUtil.isMasterPasswordValidated()
|
|
) {
|
|
return new Route(`${basePath}/master-password`);
|
|
}
|
|
|
|
return new Route(`${basePath}/`);
|
|
}
|
|
|
|
public static override logoutUser(): void {
|
|
// No-op for public dashboards
|
|
}
|
|
|
|
public static override getForbiddenRoute(): Route {
|
|
return new Route(
|
|
PublicDashboardUtil.isPreviewPage()
|
|
? `/public-dashboard/${PublicDashboardUtil.getDashboardId()?.toString()}/forbidden`
|
|
: "/forbidden",
|
|
);
|
|
}
|
|
}
|