Skip to content

Commit

Permalink
Fix document set editor refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Weves committed May 16, 2024
1 parent 8c17c77 commit 0369dde
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion web/src/lib/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { errorHandlingFetcher, fetcher } from "./fetcher";
import { useState } from "react";
import { DateRangePickerValue } from "@tremor/react";
import { SourceMetadata } from "./search/interfaces";
import { EE_ENABLED } from "./constants";

const CREDENTIAL_URL = "/api/manage/admin/credential";

Expand Down Expand Up @@ -114,9 +115,25 @@ EE Only APIs

const USER_GROUP_URL = "/api/manage/admin/user-group";

export const useUserGroups = () => {
export const useUserGroups = (): {
data: UserGroup[] | undefined;
isLoading: boolean;
error: string;
refreshUserGroups: () => void;
} => {
const swrResponse = useSWR<UserGroup[]>(USER_GROUP_URL, errorHandlingFetcher);

if (!EE_ENABLED) {
return {
...{
data: [],
isLoading: false,
error: "",
},
refreshUserGroups: () => {},
};
}

return {
...swrResponse,
refreshUserGroups: () => mutate(USER_GROUP_URL),
Expand Down

0 comments on commit 0369dde

Please sign in to comment.