22 lines
616 B
TypeScript
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;
|
|
}
|