feat:新增发布和取消发布接口

This commit is contained in:
奔跑的面条
2022-05-22 16:38:22 +08:00
parent 341015c584
commit bfac86d5dd
9 changed files with 137 additions and 35 deletions
+27 -7
View File
@@ -20,6 +20,17 @@ export const post = (url: string, data?: object, headersType?: string) => {
})
}
export const put = (url: string, data?: object, headersType?: string) => {
return axiosInstance({
url: url,
method: RequestHttpEnum.PUT,
data: data,
headers: {
'Content-Type': headersType || ContentTypeEnum.JSON
}
})
}
export const del = (url: string, params?: object) => {
return axiosInstance({
url: url,
@@ -30,11 +41,20 @@ export const del = (url: string, params?: object) => {
// 获取请求函数,默认get
export const http = (type?: RequestHttpEnum) => {
return type === RequestHttpEnum.GET
? get
: type === RequestHttpEnum.POST
? post
: type === RequestHttpEnum.DELETE
? del
: get
switch (type) {
case RequestHttpEnum.GET:
return get
case RequestHttpEnum.POST:
return post
case RequestHttpEnum.PUT:
return put
case RequestHttpEnum.DELETE:
return del
default:
return get
}
}
+10
View File
@@ -30,4 +30,14 @@ export const deleteProjectApi = async (data: object) => {
} catch {
httpErrorHandle();
}
}
// * 修改发布状态 [-1未发布,1发布]
export const changeProjectReleaseApi = async (data: object) => {
try {
const res = await http(RequestHttpEnum.PUT)(`${ModuleTypeEnum.PROJECT}/publish`, data);
return res;
} catch {
httpErrorHandle();
}
}