69 lines
1.5 KiB
TypeScript
69 lines
1.5 KiB
TypeScript
|
|
import { MeetingData } from "@/app/main/planning/projects/[projectIdentifier]/component/momTab/components/meetingForm/types";
|
|
import { baseApiRequest } from "../apiRequests/baseApiRequest";
|
|
|
|
const MEETING_API = `${process.env.NEXT_PUBLIC_PROJECT_MANAGEMENT_API_URL}/api/v1/meetings`;
|
|
|
|
|
|
// CREATE
|
|
export const createMeetingApi = async (meeting: MeetingData) => {
|
|
return baseApiRequest(
|
|
MEETING_API,
|
|
{
|
|
method: "POST",
|
|
body: JSON.stringify(meeting),
|
|
},
|
|
{ isAccessTokenRequird: true },
|
|
);
|
|
};
|
|
|
|
|
|
// READ ALL BY PROJECT ID
|
|
export const meetingsApi = async (projectIdentifier: string) => {
|
|
return baseApiRequest(
|
|
`${MEETING_API}/project/${projectIdentifier}`,
|
|
{
|
|
method: "GET",
|
|
cache: "no-store",
|
|
},
|
|
{ isAccessTokenRequird: true },
|
|
);
|
|
};
|
|
|
|
|
|
// READ BY ID
|
|
export const getMeetingByIdApi = async (meetingId: string) => {
|
|
return baseApiRequest(
|
|
`${MEETING_API}/${meetingId}`,
|
|
{
|
|
method: "GET",
|
|
cache: "no-store",
|
|
},
|
|
{ isAccessTokenRequird: true },
|
|
);
|
|
};
|
|
|
|
|
|
// UPDATE
|
|
export const updateMeetingApi = async (meetingId: string, updatedMeeting: MeetingData) => {
|
|
return baseApiRequest(
|
|
`${MEETING_API}/${meetingId}`,
|
|
{
|
|
method: "PUT",
|
|
body: JSON.stringify(updatedMeeting),
|
|
},
|
|
{ isAccessTokenRequird: true },
|
|
);
|
|
};
|
|
|
|
|
|
// DELETE
|
|
export const deleteMeetingApi = async (meetingId: string) => {
|
|
return baseApiRequest(
|
|
`${MEETING_API}/${meetingId}`,
|
|
{
|
|
method: "DELETE",
|
|
},
|
|
{ isAccessTokenRequird: true },
|
|
);
|
|
}; |