feat: change interface of analysis video log
This commit is contained in:
13
src/utils/media.ts
Normal file
13
src/utils/media.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { ENV_CONSTANT } from '@/constants/secrect.constant';
|
||||
|
||||
export function resolveMediaUrl(url?: string | null) {
|
||||
if (!url?.trim()) return null;
|
||||
|
||||
const value = url.trim();
|
||||
if (/^https?:\/\//i.test(value)) return value;
|
||||
|
||||
const baseUrl = ENV_CONSTANT.BASE_API_URL?.replace(/\/$/, '');
|
||||
const path = value.startsWith('/') ? value : `/${value}`;
|
||||
|
||||
return baseUrl ? `${baseUrl}${path}` : path;
|
||||
}
|
||||
Reference in New Issue
Block a user