import { useState, useEffect } from 'react'; import { getVideoContentCategoryListApi } from '@src/http/api'; import request from '@src/http/index'; export const useVideoCategoryOptions = () => { const [videoCategoryOptions, setVideoCategoryOptions] = useState([]); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); const getVideoCategoryList = async () => { try { setLoading(true); setError(null); const data = await request.get(getVideoContentCategoryListApi); setVideoCategoryOptions(data.data as string[]); } catch (err) { setError(err instanceof Error ? err.message : 'Failed to fetch accounts'); } finally { setLoading(false); } }; useEffect(() => { getVideoCategoryList(); }, []); return { videoCategoryOptions, getVideoCategoryList, loading, error }; };