调整api类型

This commit is contained in:
宇阳
2024-08-06 19:49:30 +08:00
parent 3d2021af59
commit 9b8a93a893
7 changed files with 11 additions and 7 deletions

View File

@@ -13,11 +13,11 @@ export const editCateDataAPI = (data: Cate) => Request<Cate>("PATCH", "/cate", d
// 获取分类
export const getCateDataAPI = (id?: number) => Request<Cate>("GET", `/cate/${id}`)
// 获取评论列表
// 获取分类列表
export const getCateListAPI = (page?: Page) => {
if (page) {
return Request<Paginate<Cate[]>>("GET", `/cate?page=${page.page}&size=${page.size}`);
} else {
return Request<Paginate<Cate[]>>("GET", `/cate`);
return Request<Cate[]>("GET", `/cate`);
}
};

View File

@@ -20,6 +20,6 @@ export const getCommentListAPI = (page?: Page) => {
if (page) {
return Request<Paginate<Comment[]>>("GET", `/comment?page=${page.page}&size=${page.size}`);
} else {
return Request<Paginate<Comment[]>>("GET", `/comment`);
return Request<Comment[]>("GET", `/comment`);
}
};

View File

@@ -1,3 +1,4 @@
import { Link } from '@/types/link'
import Request from '@/utils/request'
// 新增网站
@@ -17,6 +18,6 @@ export const getLinkListAPI = (page?: Page) => {
if (page) {
return Request<Paginate<Link[]>>("GET", `/link?page=${page.page}&size=${page.size}`);
} else {
return Request<Paginate<Link[]>>("GET", `/link`);
return Request<Link[]>("GET", `/link`);
}
};

View File

@@ -1,3 +1,4 @@
import { Swiper } from '@/types/swiper'
import Request from '@/utils/request'
// 新增轮播图
@@ -17,6 +18,6 @@ export const getSwiperListAPI = (page?: Page) => {
if (page) {
return Request<Paginate<Swiper[]>>("GET", `/swiper?page=${page.page}&size=${page.size}`);
} else {
return Request<Paginate<Swiper[]>>("GET", `/swiper`);
return Request<Swiper[]>("GET", `/swiper`);
}
};

View File

@@ -1,3 +1,4 @@
import { System, Web, Layout } from '@/types/system'
import Request from '@/utils/request'
// 获取系统配置信息

View File

@@ -1,3 +1,4 @@
import { Tag } from '@/types/tag'
import Request from '@/utils/request'
// 新增标签
@@ -17,6 +18,6 @@ export const getTagListAPI = (page?: Page) => {
if (page) {
return Request<Paginate<Tag[]>>("GET", `/tag?page=${page.page}&size=${page.size}`);
} else {
return Request<Paginate<Tag[]>>("GET", `/tag`);
return Request<Tag[]>("GET", `/tag`);
}
};

View File

@@ -21,7 +21,7 @@ instance.interceptors.request.use(
(config: InternalAxiosRequestConfig) => {
const token = store.token
if(config.method === "get") return config
// if(config.method === "get") return config
// 如果有token就把赋值给请求头
if (token) config.headers["Authorization"] = `Bearer ${token}`;