mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-10 13:15:18 +02:00
Fix google drive page
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
import * as Yup from "yup";
|
import * as Yup from "yup";
|
||||||
import { GoogleDriveIcon } from "@/components/icons/icons";
|
import { GoogleDriveIcon } from "@/components/icons/icons";
|
||||||
import useSWR, { useSWRConfig } from "swr";
|
import useSWR, { useSWRConfig } from "swr";
|
||||||
import { errorHandlingFetcher } from "@/lib/fetcher";
|
import { FetchError, errorHandlingFetcher } from "@/lib/fetcher";
|
||||||
import { ErrorCallout } from "@/components/ErrorCallout";
|
import { ErrorCallout } from "@/components/ErrorCallout";
|
||||||
import { LoadingAnimation } from "@/components/Loading";
|
import { LoadingAnimation } from "@/components/Loading";
|
||||||
import { PopupSpec, usePopup } from "@/components/admin/connectors/Popup";
|
import { PopupSpec, usePopup } from "@/components/admin/connectors/Popup";
|
||||||
@@ -264,7 +264,7 @@ const Main = () => {
|
|||||||
data: appCredentialData,
|
data: appCredentialData,
|
||||||
isLoading: isAppCredentialLoading,
|
isLoading: isAppCredentialLoading,
|
||||||
error: isAppCredentialError,
|
error: isAppCredentialError,
|
||||||
} = useSWR<{ client_id: string }>(
|
} = useSWR<{ client_id: string }, FetchError>(
|
||||||
"/api/manage/admin/connector/google-drive/app-credential",
|
"/api/manage/admin/connector/google-drive/app-credential",
|
||||||
errorHandlingFetcher
|
errorHandlingFetcher
|
||||||
);
|
);
|
||||||
@@ -272,7 +272,7 @@ const Main = () => {
|
|||||||
data: serviceAccountKeyData,
|
data: serviceAccountKeyData,
|
||||||
isLoading: isServiceAccountKeyLoading,
|
isLoading: isServiceAccountKeyLoading,
|
||||||
error: isServiceAccountKeyError,
|
error: isServiceAccountKeyError,
|
||||||
} = useSWR<{ service_account_email: string }>(
|
} = useSWR<{ service_account_email: string }, FetchError>(
|
||||||
"/api/manage/admin/connector/google-drive/service-account-key",
|
"/api/manage/admin/connector/google-drive/service-account-key",
|
||||||
errorHandlingFetcher
|
errorHandlingFetcher
|
||||||
);
|
);
|
||||||
@@ -280,7 +280,7 @@ const Main = () => {
|
|||||||
data: connectorIndexingStatuses,
|
data: connectorIndexingStatuses,
|
||||||
isLoading: isConnectorIndexingStatusesLoading,
|
isLoading: isConnectorIndexingStatusesLoading,
|
||||||
error: connectorIndexingStatusesError,
|
error: connectorIndexingStatusesError,
|
||||||
} = useSWR<ConnectorIndexingStatus<any, any>[]>(
|
} = useSWR<ConnectorIndexingStatus<any, any>[], FetchError>(
|
||||||
"/api/manage/admin/connector/indexing-status",
|
"/api/manage/admin/connector/indexing-status",
|
||||||
errorHandlingFetcher
|
errorHandlingFetcher
|
||||||
);
|
);
|
||||||
@@ -307,28 +307,19 @@ const Main = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (credentialsError || !credentialsData) {
|
if (credentialsError || !credentialsData) {
|
||||||
return (
|
return <ErrorCallout errorTitle="Failed to load credentials." />;
|
||||||
<div className="mx-auto">
|
|
||||||
<div className="text-red-500">Failed to load credentials.</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connectorIndexingStatusesError || !connectorIndexingStatuses) {
|
if (connectorIndexingStatusesError || !connectorIndexingStatuses) {
|
||||||
return (
|
return <ErrorCallout errorTitle="Failed to load connectors." />;
|
||||||
<div className="mx-auto">
|
|
||||||
<div className="text-red-500">Failed to load connectors.</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isAppCredentialError || isServiceAccountKeyError) {
|
if (
|
||||||
|
(isAppCredentialError && isAppCredentialError.status !== 404) ||
|
||||||
|
(isServiceAccountKeyError && isServiceAccountKeyError.status !== 404)
|
||||||
|
) {
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto">
|
<ErrorCallout errorTitle="Error loading Google Drive app credentials. Contact an administrator." />
|
||||||
<div className="text-red-500">
|
|
||||||
Error loading Google Drive app credentials. Contact an administrator.
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
class FetchError extends Error {
|
export class FetchError extends Error {
|
||||||
status: number;
|
status: number;
|
||||||
info: any;
|
info: any;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user