first commit
This commit is contained in:
38
frontend/app/utils/api/workingDays/index.ts
Normal file
38
frontend/app/utils/api/workingDays/index.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { baseApiRequest } from "../apiRequests/baseApiRequest";
|
||||
import { WorkingDaysResponse } from "./type";
|
||||
|
||||
const PROJECT_MANAGEMENT_BASE_URL = `${process.env.NEXT_PUBLIC_PROJECT_MANAGEMENT_API_URL}/api/v1`;
|
||||
|
||||
export const getAllWorkingDays = async (): Promise<WorkingDaysResponse> => {
|
||||
return await baseApiRequest(
|
||||
`${PROJECT_MANAGEMENT_BASE_URL}/working-days`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include",
|
||||
},
|
||||
{
|
||||
isAccessTokenRequird: true,
|
||||
revalidatePaths: ["/working-days"],
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
export const getWorkingDaysByYear = async (
|
||||
year: string,
|
||||
): Promise<WorkingDaysResponse> => {
|
||||
return await baseApiRequest(
|
||||
`${PROJECT_MANAGEMENT_BASE_URL}/working-days/year/${year}`,
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
credentials: "include",
|
||||
},
|
||||
{
|
||||
isAccessTokenRequird: true,
|
||||
revalidatePaths: [`/working-days/year/${year}`],
|
||||
},
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user