mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 12:29:41 +02:00
Fix document set editor refresh
This commit is contained in:
@@ -11,6 +11,7 @@ import { errorHandlingFetcher, fetcher } from "./fetcher";
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { DateRangePickerValue } from "@tremor/react";
|
import { DateRangePickerValue } from "@tremor/react";
|
||||||
import { SourceMetadata } from "./search/interfaces";
|
import { SourceMetadata } from "./search/interfaces";
|
||||||
|
import { EE_ENABLED } from "./constants";
|
||||||
|
|
||||||
const CREDENTIAL_URL = "/api/manage/admin/credential";
|
const CREDENTIAL_URL = "/api/manage/admin/credential";
|
||||||
|
|
||||||
@@ -114,9 +115,25 @@ EE Only APIs
|
|||||||
|
|
||||||
const USER_GROUP_URL = "/api/manage/admin/user-group";
|
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);
|
const swrResponse = useSWR<UserGroup[]>(USER_GROUP_URL, errorHandlingFetcher);
|
||||||
|
|
||||||
|
if (!EE_ENABLED) {
|
||||||
|
return {
|
||||||
|
...{
|
||||||
|
data: [],
|
||||||
|
isLoading: false,
|
||||||
|
error: "",
|
||||||
|
},
|
||||||
|
refreshUserGroups: () => {},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...swrResponse,
|
...swrResponse,
|
||||||
refreshUserGroups: () => mutate(USER_GROUP_URL),
|
refreshUserGroups: () => mutate(USER_GROUP_URL),
|
||||||
|
Reference in New Issue
Block a user