import { baseApiRequest } from "../apiRequests/baseApiRequest"; import { Role, User, RoleMembership } from "./type"; const API_BASE_URL = process.env.NEXT_PUBLIC_PROJECT_MANAGEMENT_API_URL; const IKON_API_URL = process.env.NEXT_PUBLIC_IKON_API_URL; export const getAllRoles = async (): Promise => { return await baseApiRequest( `${API_BASE_URL}/role`, { method: "GET", headers: { "Content-Type": "application/json" }, credentials: "include", }, { isAccessTokenRequird: true, revalidatePaths: ["/roles"], } ); }; export const getAllUsers = async (): Promise => { return await baseApiRequest( `${IKON_API_URL}/platform/user/current`, { method: "GET", headers: { "Content-Type": "application/json" }, credentials: "include", }, { isAccessTokenRequird: true, revalidatePaths: ["/platform/user/current"], } ); }; export const getUserById = async (userId: string): Promise => { return await baseApiRequest( `${IKON_API_URL}/platform/user/${userId}`, // Assuming this endpoint pattern { method: "GET", headers: { "Content-Type": "application/json" }, credentials: "include", }, { isAccessTokenRequird: true, revalidatePaths: [`/platform/user/${userId}`], } ); }; export const getRoleMemberships = async (roleId: string): Promise => { return await baseApiRequest( `${API_BASE_URL}/role/${roleId}/membership`, { method: "GET", headers: { "Content-Type": "application/json" }, credentials: "include", }, { isAccessTokenRequird: true, } ); };