新版本官网优化完成
This commit is contained in:
30
api/system/cache/index.ts
vendored
30
api/system/cache/index.ts
vendored
@@ -1,4 +1,4 @@
|
||||
import request from '@/utils/request';
|
||||
import request from '~/utils/request';
|
||||
import type { ApiResult } from '@/api';
|
||||
import type { Cache, CacheParam } from './model';
|
||||
import { SERVER_API_URL } from '@/config';
|
||||
@@ -13,10 +13,10 @@ export async function listCache(params?: CacheParam) {
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,8 +27,8 @@ export async function getCache(key: String) {
|
||||
const res = await request.get<ApiResult<Cache>>(
|
||||
SERVER_API_URL + '/system/cache/' + key
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,10 +41,10 @@ export async function updateCache(cache: Cache) {
|
||||
SERVER_API_URL + '/system/cache',
|
||||
cache
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -52,13 +52,13 @@ export async function updateCache(cache: Cache) {
|
||||
* @param key
|
||||
*/
|
||||
export async function removeCache(key?: String) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
SERVER_API_URL + '/system/cache/' + key
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +70,7 @@ export async function updateCacheTheme(cache: Cache) {
|
||||
SERVER_API_URL + '/system/cache/theme',
|
||||
cache
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user