cache branding for an hour

This commit is contained in:
peintnermax
2024-09-09 10:46:59 +02:00
parent b7fd7f6c0b
commit f1d9cdfafc

View File

@@ -25,6 +25,7 @@ import {
SearchQuery,
SearchQuerySchema,
} from "@zitadel/proto/zitadel/user/v2/query_pb";
import { unstable_cache } from "next/cache";
import { PROVIDER_MAPPING } from "./idp";
const SESSION_LIFETIME_S = 3000;
@@ -46,9 +47,15 @@ export const orgService = createOrganizationServiceClient(transport);
export const settingsService = createSettingsServiceClient(transport);
export async function getBrandingSettings(organization?: string) {
return settingsService
.getBrandingSettings({ ctx: makeReqCtx(organization) }, {})
.then((resp) => resp.settings);
return unstable_cache(
async () => {
return await settingsService
.getBrandingSettings({ ctx: makeReqCtx(organization) }, {})
.then((resp) => resp.settings);
},
["branding"],
{ revalidate: 3600, tags: ["branding"] },
)();
}
export async function getLoginSettings(orgId?: string) {