2024-07-03 07:58:37 +00:00
|
|
|
import axios from 'axios';
|
|
|
|
|
|
|
|
|
|
const API_URL = 'http://localhost:8080/meetings';
|
|
|
|
|
|
|
|
|
|
class MeetingService {
|
|
|
|
|
getAllMeetings() {
|
|
|
|
|
return axios.get(`${API_URL}/listAll`);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getMeetingById(id) {
|
|
|
|
|
// 使用 POST 方法并传递请求体
|
|
|
|
|
return axios.post(`${API_URL}/getMeetingById`, { id });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
createMeeting(meeting) {
|
|
|
|
|
return axios.post(`${API_URL}/addMeeting`, meeting);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateMeeting(id, meeting) {
|
|
|
|
|
// 使用 POST 方法而不是 PUT 方法
|
|
|
|
|
return axios.post(`${API_URL}/updateMeeting`, meeting);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
deleteMeeting(id) {
|
|
|
|
|
// 使用 POST 方法并传递请求体
|
|
|
|
|
return axios.post(`${API_URL}/deleteMeeting`, { id });
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default new MeetingService();
|