12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- //所有的接口请求
- import axios from "axios";
- export const cdn = import.meta.env.VITE_ROUTER_BASE
- ? ""
- : "https://assets.le5lecdn.com";
- export const upCdn = import.meta.env.VITE_ROUTER_BASE
- ? ""
- : "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("/data/folders/get", {
- query,
- });
- if (folder.error) {
- return;
- } else {
- return folder;
- }
- }
- export async function updateFolders(data: any) {
- const folder: any = await axios.post("/data/folders/update", data);
- if (folder.error) {
- return;
- } else {
- return folder;
- }
- }
- export async function addCollection(collection: string, data: any) {
- return await axios.post(`/data/${collection}/add`, data); // 新增
- }
- export async function updateCollection(collection: string, data: any) {
- return await axios.post(`/data/${collection}/update`, data); // 新增
- }
- // export async function addCollection(collection: string, data: any) {
- // return await axios.post(`/data/${collection}/add`, data); // 新增
- // }
- export async function getLe5le2d(id: string) {
- return await axios.post("/data/le5le2d/get", {
- id,
- });
- }
|