44 lines
887 B
TypeScript
44 lines
887 B
TypeScript
|
|
import { request } from './request'
|
||
|
|
|
||
|
|
export type ContactPointInfo = {
|
||
|
|
id: number
|
||
|
|
name: string
|
||
|
|
type: string
|
||
|
|
typeConfig: string
|
||
|
|
}
|
||
|
|
|
||
|
|
export const getContactPoints = () =>
|
||
|
|
request<ContactPointInfo[]>('/api/contact-points')
|
||
|
|
|
||
|
|
export const createContactPoint = (data: {
|
||
|
|
name: string
|
||
|
|
type: string
|
||
|
|
config: string
|
||
|
|
}) =>
|
||
|
|
request<ContactPointInfo>('/api/contact-points', {
|
||
|
|
method: 'POST',
|
||
|
|
headers: { 'content-type': 'application/json' },
|
||
|
|
body: JSON.stringify({ data }),
|
||
|
|
})
|
||
|
|
|
||
|
|
export const updateContactPoint = ({
|
||
|
|
id,
|
||
|
|
...body
|
||
|
|
}: {
|
||
|
|
id: number
|
||
|
|
type: string
|
||
|
|
config: string
|
||
|
|
}) =>
|
||
|
|
request<ContactPointInfo>(`/api/contact-points/${id}`, {
|
||
|
|
method: 'PUT',
|
||
|
|
headers: { 'content-type': 'application/json' },
|
||
|
|
body: JSON.stringify(body),
|
||
|
|
})
|
||
|
|
|
||
|
|
export const deleteContactPoint = (id: number) =>
|
||
|
|
request<ContactPointInfo>(
|
||
|
|
`/api/contact-points/${id}`,
|
||
|
|
{ method: 'DELETE' },
|
||
|
|
'void'
|
||
|
|
)
|