//所有的接口请求 import axios from 'axios'; const isProd = import.meta.env.BASE_URL.indexOf('https://assets.le5lecdn.com') === 0; export const cdn = isProd ? 'https://assets.le5lecdn.com' : ''; export const upCdn = isProd ? 'https://drive.le5lecdn.com' : ''; export async function delImage(image: string) { if (image.startsWith(upCdn)) { await axios.delete('/file' + image.replace(upCdn, '')); } else { await axios.delete(`${image}`); } return true; } export async function getFolders(query: any) { const folder: any = await axios.post('/api/data/folders/get', { query, }); if (folder.error) { return; } else { return folder; } } export async function updateFolders(data: any) { const folder: any = await axios.post('/api/data/folders/update', data); if (folder.error) { return; } else { return folder; } } export async function addCollection(collection: string, data: any) { return await axios.post(`/api/data/${collection}/add`, data); } export async function updateCollection(collection: string, data: any) { return await axios.post(`/api/data/${collection}/update`, data); } export async function getLe5leV(id: string) { return await axios.post('/api/data/le5leV/get', { id, }); } export async function getComponents(id: string) { return await axios.post(`/api/data/le5leV-components/get`, { id, }); } export async function getComponentsList(data: any, config: any) { return await axios.post('/api/data/le5leV-components/list', data, config); } export async function getLe5le3d(id: string) { return await axios.post(`/api/data/le5le3d/get`, { id, }); }