mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-15 09:45:04 +01:00
20 lines
416 B
TypeScript
20 lines
416 B
TypeScript
import cache from 'lib/cache';
|
|
import { getWebsite } from 'queries';
|
|
import { Website } from './types';
|
|
|
|
export async function loadWebsite(websiteId: string): Promise<Website> {
|
|
let website;
|
|
|
|
if (cache.enabled) {
|
|
website = await cache.fetchWebsite(websiteId);
|
|
} else {
|
|
website = await getWebsite({ id: websiteId });
|
|
}
|
|
|
|
if (!website || website.deletedAt) {
|
|
return null;
|
|
}
|
|
|
|
return website;
|
|
}
|