cleanup wrapper, suspense

This commit is contained in:
Max Peintner
2024-11-26 10:29:32 +01:00
parent 0ab2a100a8
commit e9f5d97352
2 changed files with 11 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
import "@/styles/globals.scss";
import { Alert, AlertType } from "@/components/alert";
import { LanguageProvider } from "@/components/language-provider";
import { LanguageSwitcher } from "@/components/language-switcher";
import { Theme } from "@/components/theme";
@@ -23,7 +24,13 @@ export default async function RootLayout({
<head />
<body>
<ThemeProvider>
<Suspense fallback={<div>Loading...</div>}>
<Suspense
fallback={
<div className="flex flex-row items-center justify-center py-4">
<Alert type={AlertType.INFO}>Loading...</Alert>
</div>
}
>
<LanguageProvider>
<div
className={`relative min-h-screen bg-background-light-600 dark:bg-background-dark-600 flex flex-col justify-center`}

View File

@@ -54,7 +54,9 @@ export const idpService = createIdpServiceClient(transport);
export const orgService = createOrganizationServiceClient(transport);
export const settingsService = createSettingsServiceClient(transport);
async function cacheWrapper(callback: Promise<unknown>) {
const useCache = process.env.DEBUG !== "true";
async function cacheWrapper<T>(callback: Promise<T>) {
"use cache";
cacheLife("hours");
@@ -62,8 +64,6 @@ async function cacheWrapper(callback: Promise<unknown>) {
}
export async function getBrandingSettings(organization?: string) {
const useCache = process.env.DEBUG !== "true";
const callback = settingsService
.getBrandingSettings({ ctx: makeReqCtx(organization) }, {})
.then((resp) => (resp.settings ? resp.settings : undefined));
@@ -72,8 +72,6 @@ export async function getBrandingSettings(organization?: string) {
}
export async function getLoginSettings(orgId?: string) {
const useCache = process.env.DEBUG !== "true";
const callback = settingsService
.getLoginSettings({ ctx: makeReqCtx(orgId) }, {})
.then((resp) => (resp.settings ? resp.settings : undefined));
@@ -108,8 +106,6 @@ export async function registerTOTP(userId: string) {
}
export async function getGeneralSettings() {
const useCache = process.env.DEBUG !== "true";
const callback = settingsService
.getGeneralSettings({}, {})
.then((resp) => resp.supportedLanguages);
@@ -118,8 +114,6 @@ export async function getGeneralSettings() {
}
export async function getLegalAndSupportSettings(organization?: string) {
const useCache = process.env.DEBUG !== "true";
const callback = settingsService
.getLegalAndSupportSettings({ ctx: makeReqCtx(organization) }, {})
.then((resp) => (resp.settings ? resp.settings : undefined));
@@ -128,8 +122,6 @@ export async function getLegalAndSupportSettings(organization?: string) {
}
export async function getPasswordComplexitySettings(organization?: string) {
const useCache = process.env.DEBUG !== "true";
const callback = settingsService
.getPasswordComplexitySettings({ ctx: makeReqCtx(organization) })
.then((resp) => (resp.settings ? resp.settings : undefined));