chore: pr feedbacks
This commit is contained in:
parent
4a2f857a2f
commit
f1b6156b75
3 changed files with 5 additions and 4 deletions
|
|
@ -29,7 +29,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "~
|
|||
import { formatDuration } from "~/utils/utils";
|
||||
import { formatDateTime } from "~/client/lib/datetime";
|
||||
import { deleteSnapshotsMutation, tagSnapshotsMutation } from "~/client/api-client/@tanstack/react-query.gen";
|
||||
import { handleRepositoryError } from "~/client/lib/errors";
|
||||
import { parseError } from "~/client/lib/errors";
|
||||
import type { BackupSchedule, Snapshot } from "../lib/types";
|
||||
import { cn } from "../lib/utils";
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ export const SnapshotsTable = ({ snapshots, repositoryId, backups }: Props) => {
|
|||
{
|
||||
loading: `Deleting ${selectedIds.size} snapshots...`,
|
||||
success: "Snapshots deleted successfully",
|
||||
error: (error) => handleRepositoryError("Failed to delete snapshots", error, repositoryId),
|
||||
error: (error) => parseError(error)?.message || "Failed to delete snapshots",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
|
@ -111,7 +111,7 @@ export const SnapshotsTable = ({ snapshots, repositoryId, backups }: Props) => {
|
|||
{
|
||||
loading: `Re-tagging ${selectedIds.size} snapshots...`,
|
||||
success: `Snapshots re-tagged to ${schedule.name}`,
|
||||
error: (error) => handleRepositoryError("Failed to re-tag snapshots", error, repositoryId),
|
||||
error: (error) => parseError(error)?.message || "Failed to re-tag snapshots",
|
||||
},
|
||||
);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@ export const showLockErrorToast = (repositoryId: string, title: string) => {
|
|||
export const handleRepositoryError = (title: string, error: unknown, repositoryId: string) => {
|
||||
if (isLockError(error)) {
|
||||
showLockErrorToast(repositoryId, title);
|
||||
return null;
|
||||
}
|
||||
|
||||
toast.error(parseError(error)?.message || "An unexpected error occurred");
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ export default function ScheduleDetailsPage({ params, loaderData }: Route.Compon
|
|||
{
|
||||
loading: "Deleting snapshot...",
|
||||
success: "Snapshot deleted successfully",
|
||||
error: (error) => handleRepositoryError("Failed to delete snapshot", error, schedule.repository.shortId),
|
||||
error: (error) => parseError(error)?.message || "Failed to delete snapshot",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue