first commit

This commit is contained in:
Your NamebaishaliHolocron
2026-06-15 12:57:03 +05:30
commit b9ac5ae0b2
398 changed files with 49583 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
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<Role[]> => {
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<User[]> => {
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<User | null> => {
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<RoleMembership[]> => {
return await baseApiRequest(
`${API_BASE_URL}/role/${roleId}/membership`,
{
method: "GET",
headers: { "Content-Type": "application/json" },
credentials: "include",
},
{
isAccessTokenRequird: true,
}
);
};