24 lines
872 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import axios from 'axios';
import CONFIG from '@/core/config.js';
const getProjectFiles = async (projectId) => {
try {
const token = localStorage.getItem('access_token');
const response = await axios.get(
`${CONFIG.BASE_URL}/project_files/projects/${projectId}/`,
{
headers: {
Authorization: `Bearer ${token}`,
},
withCredentials: true,
}
);
return response.data;
} catch (error) {
const errorMessage = error.response?.data?.detail || error.message;
console.error(`Ошибка загрузки файлов проекта с ID ${projectId}:`, errorMessage);
throw new Error(`Не удалось загрузить файлы проекта: ${errorMessage}`);
}
};
export default getProjectFiles;