Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Anchel123 committed Feb 4, 2025
1 parent b6b5a6b commit 30af6b4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/components/ForceGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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`,
Expand Down
2 changes: 1 addition & 1 deletion app/settings/users/Users.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export async function securedFetch(
toast?: any,
): Promise<Response> {

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()
Expand Down

0 comments on commit 30af6b4

Please sign in to comment.