first commit
This commit is contained in:
69
frontend/app/utils/api/meetingApi/index.tsx
Normal file
69
frontend/app/utils/api/meetingApi/index.tsx
Normal file
@@ -0,0 +1,69 @@
|
||||
|
||||
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 },
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user