2024-03-29 21:42:09 +01:00
|
|
|
import { request } from './request'
|
|
|
|
|
|
|
|
|
|
export type ContactPointInfo = {
|
|
|
|
|
id: number
|
|
|
|
|
name: string
|
|
|
|
|
type: string
|
|
|
|
|
typeConfig: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const getContactPoints = () =>
|
|
|
|
|
request<ContactPointInfo[]>('/api/contact-points')
|
|
|
|
|
|
2024-03-31 09:50:09 +02:00
|
|
|
export const createContactPoint = (data: Omit<ContactPointInfo, 'id'>) =>
|
2024-03-29 21:42:09 +01:00
|
|
|
request<ContactPointInfo>('/api/contact-points', {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
2024-03-31 09:50:09 +02:00
|
|
|
body: JSON.stringify(data),
|
2024-03-29 21:42:09 +01:00
|
|
|
})
|
|
|
|
|
|
2024-03-31 09:50:09 +02:00
|
|
|
export const updateContactPoint = ({ id, ...body }: ContactPointInfo) =>
|
2024-03-29 21:42:09 +01:00
|
|
|
request<ContactPointInfo>(`/api/contact-points/${id}`, {
|
|
|
|
|
method: 'PUT',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
|
|
|
|
body: JSON.stringify(body),
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
export const deleteContactPoint = (id: number) =>
|
2024-04-01 17:03:45 +02:00
|
|
|
request<void, 'void'>(
|
2024-03-29 21:42:09 +01:00
|
|
|
`/api/contact-points/${id}`,
|
|
|
|
|
{ method: 'DELETE' },
|
|
|
|
|
'void'
|
|
|
|
|
)
|
2024-03-31 09:50:09 +02:00
|
|
|
|
|
|
|
|
export const testContactPoint = (body: { type: string; typeConfig: string }) =>
|
|
|
|
|
request<ContactPointInfo>(`/api/contact-points/test`, {
|
|
|
|
|
method: 'POST',
|
|
|
|
|
headers: { 'content-type': 'application/json' },
|
|
|
|
|
body: JSON.stringify(body),
|
|
|
|
|
})
|