feat: first step of adding core charge functionality

Signed-off-by: Chloe <pinkcloudvnn@gmail.com>
This commit is contained in:
Chloe
2024-04-24 16:38:08 +07:00
parent 649a54891c
commit e3f564ca77
12 changed files with 412 additions and 28 deletions

View File

@@ -47,3 +47,11 @@ export function cn(...inputs: ClassValue[]) {
export function normalizeUrl(domain: string, url: string) {
return url.replace(domain, '').replace('/collections', '/search').replace('/pages', '');
}
export const parseMetaFieldValue = <T>(field: { value: string } | null): T | null => {
try {
return JSON.parse(field?.value || '{}');
} catch (error) {
return null;
}
};