project.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. import {axios} from "@/requests/axios.config";
  2. const prefix = "/project";
  3. function findAllProjects() {
  4. return axios.get(`${prefix}/findAll`);
  5. }
  6. function findCourseProjects() {
  7. return axios.get(`${prefix}/findCourse`);
  8. }
  9. function findNonCourseProjects() {
  10. return axios.get(`${prefix}/findNonCourse`);
  11. }
  12. function findProjectById(id) {
  13. return axios.get(`${prefix}/findById`, {
  14. params: {
  15. id,
  16. }
  17. });
  18. }
  19. function findProjectsByCourse(courseId) {
  20. return axios.get(`${prefix}/findByCourse`, {
  21. params: {
  22. courseId,
  23. }
  24. });
  25. }
  26. function createProject(data) {
  27. return axios.post(`${prefix}`, data);
  28. }
  29. function findProjectMembers(id) {
  30. return axios.get(`${prefix}/findMembers`, {
  31. params: {
  32. id,
  33. }
  34. });
  35. }
  36. function updateCourseProjectState(id) {
  37. return axios.put(`${prefix}/updateState`, null, {
  38. params: {
  39. id,
  40. }
  41. });
  42. }
  43. function forkProject(projectId, name = null) {
  44. return axios.post(`${prefix}/fork`, null, {
  45. params: {
  46. projectId,
  47. name,
  48. }
  49. });
  50. }
  51. function findAllPublicProjectsGroupByCourse() {
  52. return axios.get(`${prefix}/findAllPublicGroupByCourse`);
  53. }
  54. const projectAPIs = {
  55. findAllProjects,
  56. findCourseProjects,
  57. findNonCourseProjects,
  58. findProjectById,
  59. findProjectMembers,
  60. findProjectsByCourse,
  61. createProject,
  62. updateCourseProjectState,
  63. forkProject,
  64. findAllPublicProjectsGroupByCourse,
  65. };
  66. export default projectAPIs;