* chore: add next-themes * feat: add next theme provider * fix: modify useTheme hook to use next-themes * fix: use the new hook for theming * remove conditional rendering with isReady boolean flag * remove Theme component returned from useTheme hook * Update missing useTheme usage * Fix theme switching as per system. Also, ensure that booking and non booking pages can maintain their own requirements of theme simulatenously Co-authored-by: Peer Richelsen <peeroke@gmail.com> Co-authored-by: zomars <zomars@me.com> Co-authored-by: Alex van Andel <me@alexvanandel.com> Co-authored-by: Hariom Balhara <hariombalhara@gmail.com>
27 lines
712 B
TypeScript
27 lines
712 B
TypeScript
import cache from "memory-cache";
|
|
|
|
import { CONSOLE_URL } from "@calcom/lib/constants";
|
|
|
|
const CACHING_TIME = 86400000; // 24 hours in milliseconds
|
|
|
|
async function checkLicense(license: string): Promise<boolean> {
|
|
return true;
|
|
if (!!process.env.NEXT_PUBLIC_IS_E2E) return true;
|
|
const url = `${CONSOLE_URL}/api/license?key=${license}`;
|
|
const cachedResponse = cache.get(url);
|
|
if (cachedResponse) {
|
|
return cachedResponse;
|
|
} else {
|
|
try {
|
|
const response = await fetch(url, { mode: "cors" });
|
|
const data = await response.json();
|
|
cache.put(url, data.valid, CACHING_TIME);
|
|
return data.valid;
|
|
} catch (error) {
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
export default checkLicense;
|