import axiosInstance from '../../../../utils/axiosInstance';

const fetchTopicsBySectionId = async (sectionId) => {
  try {
    const response = await axiosInstance.get(`/topic/section/${sectionId}`);
    return response.data;
  } catch (error) {
    return [];
  }
};

const fetchSectionById = async (sectionId) => {
  try {
    const response = await axiosInstance.get(`/section/${sectionId}`);
    return response.data;
  } catch (error) {
    throw new Error('Failed to fetch section');
  }
};

export default {
    fetchTopicsBySectionId,
    fetchSectionById,
};
