mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-08 22:20:20 +02:00
Remove mildly annoying groups fetch (#2733)
* remove mildly annoying groups fetch * ensure in client component
This commit is contained in:
parent
f83e6806b6
commit
10f221cd37
@ -1,3 +1,4 @@
|
|||||||
|
"use client";
|
||||||
import {
|
import {
|
||||||
ConnectorIndexingStatus,
|
ConnectorIndexingStatus,
|
||||||
DocumentBoostStatus,
|
DocumentBoostStatus,
|
||||||
@ -6,14 +7,14 @@ import {
|
|||||||
} from "@/lib/types";
|
} from "@/lib/types";
|
||||||
import useSWR, { mutate, useSWRConfig } from "swr";
|
import useSWR, { mutate, useSWRConfig } from "swr";
|
||||||
import { errorHandlingFetcher } from "./fetcher";
|
import { errorHandlingFetcher } from "./fetcher";
|
||||||
import { useEffect, useState } from "react";
|
import { useContext, useEffect, useState } from "react";
|
||||||
import { DateRangePickerValue } from "@tremor/react";
|
import { DateRangePickerValue } from "@tremor/react";
|
||||||
import { SourceMetadata } from "./search/interfaces";
|
import { SourceMetadata } from "./search/interfaces";
|
||||||
import { destructureValue } from "./llm/utils";
|
import { destructureValue } from "./llm/utils";
|
||||||
import { ChatSession } from "@/app/chat/interfaces";
|
import { ChatSession } from "@/app/chat/interfaces";
|
||||||
import { UsersResponse } from "./users/interfaces";
|
import { UsersResponse } from "./users/interfaces";
|
||||||
import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled";
|
|
||||||
import { Credential } from "./connectors/credentials";
|
import { Credential } from "./connectors/credentials";
|
||||||
|
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
||||||
|
|
||||||
const CREDENTIAL_URL = "/api/manage/admin/credential";
|
const CREDENTIAL_URL = "/api/manage/admin/credential";
|
||||||
|
|
||||||
@ -220,8 +221,14 @@ export const useUserGroups = (): {
|
|||||||
error: string;
|
error: string;
|
||||||
refreshUserGroups: () => void;
|
refreshUserGroups: () => void;
|
||||||
} => {
|
} => {
|
||||||
const swrResponse = useSWR<UserGroup[]>(USER_GROUP_URL, errorHandlingFetcher);
|
const combinedSettings = useContext(SettingsContext);
|
||||||
const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
|
const isPaidEnterpriseFeaturesEnabled =
|
||||||
|
combinedSettings && combinedSettings.enterpriseSettings !== null;
|
||||||
|
|
||||||
|
const swrResponse = useSWR<UserGroup[]>(
|
||||||
|
isPaidEnterpriseFeaturesEnabled ? USER_GROUP_URL : null,
|
||||||
|
errorHandlingFetcher
|
||||||
|
);
|
||||||
|
|
||||||
if (!isPaidEnterpriseFeaturesEnabled) {
|
if (!isPaidEnterpriseFeaturesEnabled) {
|
||||||
return {
|
return {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user