mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-25 19:15:18 +02:00
fix: remove error message display for Google Drive and OneDrive authentication issues; add toast notifications for picker errors
This commit is contained in:
parent
ea218b7be6
commit
101e426792
4 changed files with 7 additions and 5 deletions
|
|
@ -242,8 +242,6 @@ export const GoogleDriveConfig: FC<ConnectorConfigProps> = ({ connector, onConfi
|
||||||
{totalSelected > 0 ? "Change Selection" : "Select from Google Drive"}
|
{totalSelected > 0 ? "Change Selection" : "Select from Google Drive"}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{pickerError && !isAuthExpired && <p className="text-xs text-destructive">{pickerError}</p>}
|
|
||||||
|
|
||||||
{isAuthExpired && (
|
{isAuthExpired && (
|
||||||
<p className="text-xs text-amber-600 dark:text-amber-500">
|
<p className="text-xs text-amber-600 dark:text-amber-500">
|
||||||
Your Google Drive authentication has expired. Please re-authenticate using the button
|
Your Google Drive authentication has expired. Please re-authenticate using the button
|
||||||
|
|
|
||||||
|
|
@ -220,8 +220,6 @@ export const OneDriveConfig: FC<ConnectorConfigProps> = ({ connector, onConfigCh
|
||||||
{totalSelected > 0 ? "Change Selection" : "Select from OneDrive"}
|
{totalSelected > 0 ? "Change Selection" : "Select from OneDrive"}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{pickerError && !isAuthExpired && <p className="text-xs text-destructive">{pickerError}</p>}
|
|
||||||
|
|
||||||
{isAuthExpired && (
|
{isAuthExpired && (
|
||||||
<p className="text-xs text-amber-600 dark:text-amber-500">
|
<p className="text-xs text-amber-600 dark:text-amber-500">
|
||||||
Your OneDrive authentication has expired. Please re-authenticate using the button
|
Your OneDrive authentication has expired. Please re-authenticate using the button
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
|
import { toast } from "sonner";
|
||||||
import { connectorsApiService } from "@/lib/apis/connectors-api.service";
|
import { connectorsApiService } from "@/lib/apis/connectors-api.service";
|
||||||
|
|
||||||
export interface PickerItem {
|
export interface PickerItem {
|
||||||
|
|
@ -159,7 +160,9 @@ export function useGooglePicker({ connectorId, onPicked }: UseGooglePickerOption
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action === google.picker.Action.ERROR) {
|
if (action === google.picker.Action.ERROR) {
|
||||||
setError("Google Drive encountered an error. Please try again.");
|
const msg = "Google Drive encountered an error. Please try again.";
|
||||||
|
setError(msg);
|
||||||
|
toast.error("Google Drive Picker failed", { description: msg });
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|
@ -180,6 +183,7 @@ export function useGooglePicker({ connectorId, onPicked }: UseGooglePickerOption
|
||||||
openingRef.current = false;
|
openingRef.current = false;
|
||||||
const msg = err instanceof Error ? err.message : "Failed to open Google Picker";
|
const msg = err instanceof Error ? err.message : "Failed to open Google Picker";
|
||||||
setError(msg);
|
setError(msg);
|
||||||
|
toast.error("Google Drive Picker failed", { description: msg });
|
||||||
console.error("Google Picker error:", err);
|
console.error("Google Picker error:", err);
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { useCallback, useEffect, useRef, useState } from "react";
|
import { useCallback, useEffect, useRef, useState } from "react";
|
||||||
|
import { toast } from "sonner";
|
||||||
import { authenticatedFetch } from "@/lib/auth-utils";
|
import { authenticatedFetch } from "@/lib/auth-utils";
|
||||||
|
|
||||||
export interface OneDrivePickerItem {
|
export interface OneDrivePickerItem {
|
||||||
|
|
@ -241,6 +242,7 @@ export function useOneDrivePicker({ connectorId, onPicked }: UseOneDrivePickerOp
|
||||||
openingRef.current = false;
|
openingRef.current = false;
|
||||||
const msg = err instanceof Error ? err.message : "Failed to open OneDrive Picker";
|
const msg = err instanceof Error ? err.message : "Failed to open OneDrive Picker";
|
||||||
setError(msg);
|
setError(msg);
|
||||||
|
toast.error("OneDrive Picker failed", { description: msg });
|
||||||
console.error("OneDrive Picker error:", err);
|
console.error("OneDrive Picker error:", err);
|
||||||
window.dispatchEvent(new Event(ONEDRIVE_PICKER_CLOSE_EVENT));
|
window.dispatchEvent(new Event(ONEDRIVE_PICKER_CLOSE_EVENT));
|
||||||
} finally {
|
} finally {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue