From 30af6b42718b3986a3f48590f08df442cbd0d11b Mon Sep 17 00:00:00 2001 From: Anchel135 Date: Tue, 4 Feb 2025 17:10:40 +0200 Subject: [PATCH] commit --- app/components/ForceGraph.tsx | 2 +- app/settings/users/Users.tsx | 2 +- lib/utils.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/components/ForceGraph.tsx b/app/components/ForceGraph.tsx index 26906e75..3a902e23 100644 --- a/app/components/ForceGraph.tsx +++ b/app/components/ForceGraph.tsx @@ -85,7 +85,7 @@ export default function ForceGraph({ if (result.ok) { const json = await result.json() const elements = graph.extend(json.result, true) - if (elements.length > 0) { + if (elements.length === 0) { toast({ title: `No neighbors found`, description: `No neighbors found`, diff --git a/app/settings/users/Users.tsx b/app/settings/users/Users.tsx index 2716b530..0d651c28 100644 --- a/app/settings/users/Users.tsx +++ b/app/settings/users/Users.tsx @@ -27,7 +27,7 @@ export default function Users() { const { data: session } = useSession() const handleSetRole = async (username: string, role: string, oldRole?: string) => { - const result = await securedFetch(`api/user/${prepareArg(username)}/?role=${role}`, { + const result = await securedFetch(`api/user/${prepareArg(username)}`, { method: 'PATCH' }, session?.user?.role, toast) diff --git a/lib/utils.ts b/lib/utils.ts index 9bf38d83..b19e03e3 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -18,7 +18,7 @@ export async function securedFetch( toast?: any, ): Promise { - const response = await fetch(`${url}${url.includes("?") ? "&" : "?"}role=${role}`, init) + const response = await fetch(`${url}${role && (url.includes("?") ? "&" : "?")}role=${role}`, init) const { status } = response if (status >= 300) { const err = await response.text()