Files
MoonTVPlus/src/hooks/useRecommendationDataSource.ts
T
2025-12-27 23:45:34 +08:00

22 lines
616 B
TypeScript

'use client';
import { useEffect, useState } from 'react';
/**
* Hook to get the recommendation data source configuration
* @returns The recommendation data source setting (Douban, TMDB, Mixed, MixedSmart)
*/
export function useRecommendationDataSource(): string {
const [dataSource, setDataSource] = useState<string>('Mixed');
useEffect(() => {
// 从运行时配置中读取
if (typeof window !== 'undefined' && window.RUNTIME_CONFIG) {
const configValue = window.RUNTIME_CONFIG.RecommendationDataSource;
setDataSource(configValue || 'Mixed');
}
}, []);
return dataSource;
}