37 lines
962 B
TypeScript
37 lines
962 B
TypeScript
import { baseApiRequest } from "../../apiRequests/baseApiRequest";
|
|
import { RoleResponse, RoleResponseDto } from "./type";
|
|
|
|
const PROJECT_MANAGEMENT_BASE_URL = `${process.env.NEXT_PUBLIC_PROJECT_MANAGEMENT_API_URL}/api/v1`;
|
|
|
|
export const getAllRoles = async (): Promise<RoleResponse> => {
|
|
return await baseApiRequest(
|
|
`${PROJECT_MANAGEMENT_BASE_URL}/roles`,
|
|
{
|
|
method: "GET",
|
|
headers: { "Content-Type": "application/json" },
|
|
credentials: "include",
|
|
},
|
|
{
|
|
isAccessTokenRequird: true,
|
|
revalidatePaths: ["/roles"],
|
|
},
|
|
);
|
|
};
|
|
|
|
export const getRoleById = async (id: string): Promise<RoleResponseDto> => {
|
|
return await baseApiRequest(
|
|
`${PROJECT_MANAGEMENT_BASE_URL}/roles/${id}`,
|
|
{
|
|
method: "GET",
|
|
headers: {
|
|
"Content-Type": "application/json",
|
|
},
|
|
credentials: "include",
|
|
},
|
|
{
|
|
isAccessTokenRequird: true,
|
|
revalidatePaths: [`/roles/${id}`],
|
|
},
|
|
);
|
|
};
|