Forráskód Böngészése

feat:补充了交流的接口

DingXiaoYu 3 éve
szülő
commit
3ebc630330
1 módosított fájl, 32 hozzáadás és 0 törlés
  1. 32 0
      src/api/communications.js

+ 32 - 0
src/api/communications.js

@@ -15,10 +15,42 @@ function getCommunicationDetail(communicationId) {
     return axios.get(`https://www.fastmock.site/mock/7626b3aeb545b939cbf526e8fcfda744/api/communications/${communicationId}`);
 }
 
+function getUserPublishCommunication(userId,page,size){
+    return axios.get(`${prefix}/users/${userId}`,{params:{page,size}});
+}
+
+function starCommunication(userId,communicationId){
+    return axios.post(`${prefix}/${communicationId}/stars`,{params:{userId}});
+}
+
+function cancelStarCommunication(userId,communicationId){
+    return axios.delete(`${prefix}/${communicationId}/stars`,{params:{userId}});
+}
+
+function getStarredCommunication(userId,page,size){
+    return axios.get(`${prefix}/stars/users/${userId}`,{params:{page,size}});
+}
+
+function uploadFile(file){
+    let data = new FormData();
+    data.append("file", file);
+    return axios.post(`${prefix}/upload`, data);
+}
+
+function postCommunication(communication){
+    return axios.post(`${prefix}`,communication);
+}
+
 const communicationsAPIs = {
     getAllCommunications,
     getCommunicationStarers,
     getCommunicationDetail,
+    getUserPublishCommunication,
+    starCommunication,
+    cancelStarCommunication,
+    getStarredCommunication,
+    uploadFile,
+    postCommunication,
 };
 
 export default communicationsAPIs;