v2 refacting
This commit is contained in:
+36
-12
@@ -1,26 +1,50 @@
|
||||
import { service } from '../utils/request'
|
||||
|
||||
const headers = {
|
||||
'Content-Type': 'application/json;charsetset=UTF-8'
|
||||
}
|
||||
|
||||
const put_event = (data: Object) => {
|
||||
/**
|
||||
* 日历事件 API
|
||||
* 对应后端 CalendarController: /api/v1/events
|
||||
*/
|
||||
const post_event = (data: {
|
||||
eventDate: string
|
||||
title: string
|
||||
eventInfo?: string
|
||||
}) => {
|
||||
return service({
|
||||
url: '/calendar/api/v1/event',
|
||||
method: 'PUT',
|
||||
data: data
|
||||
url: '/calendar/api/v1/events',
|
||||
method: 'POST',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
const get_event = () => {
|
||||
return service({
|
||||
url: '/calendar/api/v1/event',
|
||||
method: 'GET',
|
||||
headers: headers
|
||||
url: '/calendar/api/v1/events',
|
||||
method: 'GET'
|
||||
})
|
||||
}
|
||||
|
||||
const put_event = (id: number, data: {
|
||||
eventDate: string
|
||||
title: string
|
||||
eventInfo?: string
|
||||
}) => {
|
||||
return service({
|
||||
url: `/calendar/api/v1/events/${id}`,
|
||||
method: 'PUT',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
const delete_event = (id: number) => {
|
||||
return service({
|
||||
url: `/calendar/api/v1/events/${id}`,
|
||||
method: 'DELETE'
|
||||
})
|
||||
}
|
||||
|
||||
export {
|
||||
get_event,
|
||||
post_event,
|
||||
put_event,
|
||||
}
|
||||
delete_event,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user