mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-25 19:15:18 +02:00
fix: fix backward compatibility in google calendar connector page
This commit is contained in:
parent
6cccd48797
commit
939ac63d0e
1 changed files with 7 additions and 5 deletions
|
|
@ -23,6 +23,7 @@ import {
|
||||||
import { EnumConnectorName } from "@/contracts/enums/connector";
|
import { EnumConnectorName } from "@/contracts/enums/connector";
|
||||||
import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
|
import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
|
||||||
import { authenticatedFetch } from "@/lib/auth-utils";
|
import { authenticatedFetch } from "@/lib/auth-utils";
|
||||||
|
import { SearchSourceConnector } from "@/contracts/types/connector.types";
|
||||||
|
|
||||||
export default function GoogleCalendarConnectorPage() {
|
export default function GoogleCalendarConnectorPage() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
|
@ -31,18 +32,19 @@ export default function GoogleCalendarConnectorPage() {
|
||||||
const [isConnecting, setIsConnecting] = useState(false);
|
const [isConnecting, setIsConnecting] = useState(false);
|
||||||
const [doesConnectorExist, setDoesConnectorExist] = useState(false);
|
const [doesConnectorExist, setDoesConnectorExist] = useState(false);
|
||||||
|
|
||||||
const { data: connectors } = useAtomValue(connectorsAtom);
|
const { refetch : fetchConnectors } = useAtomValue(connectorsAtom);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (connectors) {
|
fetchConnectors().then((data) => {
|
||||||
|
const connectors = data.data || [];
|
||||||
const connector = connectors.find(
|
const connector = connectors.find(
|
||||||
(c) => c.connector_type === EnumConnectorName.GOOGLE_CALENDAR_CONNECTOR
|
(c: SearchSourceConnector) => c.connector_type === EnumConnectorName.GOOGLE_CALENDAR_CONNECTOR
|
||||||
);
|
);
|
||||||
if (connector) {
|
if (connector) {
|
||||||
setDoesConnectorExist(true);
|
setDoesConnectorExist(true);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
}, [connectors]);
|
}, []);
|
||||||
|
|
||||||
// Handle Google OAuth connection
|
// Handle Google OAuth connection
|
||||||
const handleConnectGoogle = async () => {
|
const handleConnectGoogle = async () => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue