mirror of
https://gitlab.com/vyla-entertainment/home-frontend.git
synced 2026-11-20 13:05:38 -05:00
Released New Website
This commit is contained in:
12
src/scripts/services/showcases-service.js
Normal file
12
src/scripts/services/showcases-service.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { DATA_PATHS } from '../config/constants.js';
|
||||
import { fetchJsonArray } from './json-source.js';
|
||||
import { youtubeIdFromUrl } from '../utils/youtube.js';
|
||||
|
||||
export async function getShowcaseVideos() {
|
||||
const links = await fetchJsonArray(DATA_PATHS.showcases);
|
||||
const videos = links
|
||||
.map((url) => ({ url, id: youtubeIdFromUrl(url) }))
|
||||
.filter((video) => video.id);
|
||||
if (!videos.length) throw new Error('No valid showcase videos found');
|
||||
return videos;
|
||||
}
|
||||
Reference in New Issue
Block a user