Refactor route handlers and CMS clients
Refactored the route handlers to use a new `enhanceRouteHandler` function for better control over request handlers and user authentication. CMS clients are now created using factory functions for better encapsulation and control over instance creation. Renamed `client.ts` in 'keystatic' to `keystatic-client.ts`.
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
export * from './client';
|
||||
export * from './keystatic-client';
|
||||
export * from './content-renderer';
|
||||
|
||||
@@ -3,7 +3,11 @@ import { Cms, CmsClient } from '@kit/cms';
|
||||
import { createKeystaticReader } from './create-reader';
|
||||
import { PostEntryProps } from './keystatic.config';
|
||||
|
||||
export class KeystaticClient implements CmsClient {
|
||||
export function createKeystaticClient() {
|
||||
return new KeystaticClient();
|
||||
}
|
||||
|
||||
class KeystaticClient implements CmsClient {
|
||||
async getContentItems(options: Cms.GetContentItemsOptions) {
|
||||
const reader = await createKeystaticReader();
|
||||
|
||||
Reference in New Issue
Block a user