s
This commit is contained in:
parent
e1121da7b9
commit
abf15a7a7d
@ -28,6 +28,8 @@ export async function GET(request: Request) {
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
console.log("[Users] - data FROM ROUTE", data);
|
||||
|
||||
return NextResponse.json(data, { status: response.status });
|
||||
} catch (err: unknown) {
|
||||
console.error("Proxy GET /api/v1/users/list error:", err);
|
||||
|
||||
@ -15,7 +15,6 @@ interface IPageLinksProps extends ISidebarLink {
|
||||
// PageLinks component
|
||||
export default function PageLinks({ title, path, icon }: IPageLinksProps) {
|
||||
const Icon = resolveIcon(icon);
|
||||
console.log("Icon", Icon);
|
||||
return (
|
||||
<Link href={path} className={clsx("page-link", "page-link__container")}>
|
||||
{Icon && <Icon />}
|
||||
|
||||
@ -151,8 +151,6 @@ export default function AuditTableClient({
|
||||
|
||||
const loading = isNavigating;
|
||||
|
||||
console.log("LOADING", loading);
|
||||
|
||||
return (
|
||||
<div className="audits-page">
|
||||
<Box sx={{ display: "flex", gap: 2, mt: 5 }}>
|
||||
|
||||
@ -230,7 +230,6 @@ export const addUser = createAsyncThunk<
|
||||
try {
|
||||
const state = getState();
|
||||
const currentUserId = state.auth.user?.id;
|
||||
console.log("[DEBUG] [ADD-USER] [currentUserId]: ", currentUserId);
|
||||
const res = await fetch("/api/auth/register", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
@ -239,8 +238,6 @@ export const addUser = createAsyncThunk<
|
||||
|
||||
const data = await res.json();
|
||||
|
||||
console.log("[DEBUG] [ADD-USER] [data]: ", data);
|
||||
|
||||
if (!res.ok) {
|
||||
return rejectWithValue(data.message || "Failed to create user");
|
||||
}
|
||||
|
||||
@ -8,7 +8,17 @@ import {
|
||||
USERS_CACHE_TAG,
|
||||
} from "./constants";
|
||||
|
||||
export async function fetchUsers(): Promise<IUser[]> {
|
||||
const DEFAULT_PAGE_SIZE = 25;
|
||||
|
||||
interface FetchUsersParams {
|
||||
limit?: number;
|
||||
page?: number;
|
||||
}
|
||||
|
||||
export async function fetchUsers({
|
||||
limit = DEFAULT_PAGE_SIZE,
|
||||
page = 1,
|
||||
}: FetchUsersParams = {}): Promise<IUser[]> {
|
||||
const cookieStore = await cookies();
|
||||
const token = cookieStore.get(AUTH_COOKIE_NAME)?.value;
|
||||
|
||||
@ -16,8 +26,14 @@ export async function fetchUsers(): Promise<IUser[]> {
|
||||
throw new Error("Missing auth token");
|
||||
}
|
||||
|
||||
const backendUrl = `${BE_BASE_URL}/api/v1/users`;
|
||||
const params = new URLSearchParams();
|
||||
params.set("limit", String(limit));
|
||||
params.set("page", String(page));
|
||||
|
||||
const backendUrl = `${BE_BASE_URL}/api/v1/users${
|
||||
params.size ? `?${params.toString()}` : ""
|
||||
}`;
|
||||
console.log("[Users] - backendUrl", backendUrl);
|
||||
const response = await fetch(backendUrl, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
|
||||
@ -26,6 +26,7 @@ import AccountBalanceIcon from "@mui/icons-material/AccountBalance";
|
||||
import PaymentIcon from "@mui/icons-material/Payment";
|
||||
import CurrencyExchangeIcon from "@mui/icons-material/CurrencyExchange";
|
||||
import ViewSidebarIcon from "@mui/icons-material/ViewSidebar";
|
||||
import CompareArrowsIcon from "@mui/icons-material/CompareArrows";
|
||||
|
||||
const IconMap = {
|
||||
HomeIcon,
|
||||
@ -53,6 +54,7 @@ const IconMap = {
|
||||
PaymentIcon,
|
||||
CurrencyExchangeIcon,
|
||||
ViewSidebarIcon,
|
||||
CompareArrowsIcon,
|
||||
};
|
||||
|
||||
export default IconMap;
|
||||
|
||||
@ -56,7 +56,6 @@ async function validateToken(token: string) {
|
||||
algorithms: ["HS256"],
|
||||
});
|
||||
|
||||
console.log("[middleware] payload", payload);
|
||||
return payload as {
|
||||
exp?: number;
|
||||
MustChangePassword?: boolean;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user