diff --git a/web/ConnectionView.tsx b/web/ConnectionView.tsx
index c7d2bcd..d40ea99 100644
--- a/web/ConnectionView.tsx
+++ b/web/ConnectionView.tsx
@@ -1,4 +1,5 @@
import type { ServiceConnection } from 'officerdev';
+import type { FormEvent } from 'react';
import { useEffect, useState } from 'react';
import { CheckCircle2, Loader2, Plug, Trash2, TriangleAlert } from 'lucide-react';
import { Button } from '@/components/ui/button';
@@ -89,7 +90,8 @@ export const ConnectionView = () => {
setShowAdvanced(!!connection?.username);
}, [connection?.id]);
- const submit = async () => {
+ const submit = async (ev?: FormEvent) => {
+ ev?.preventDefault();
setError('');
try {
await save.mutateAsync({ url: url.trim(), username: username.trim(), password, rpcPath: rpcPath.trim() });
@@ -135,7 +137,7 @@ export const ConnectionView = () => {
{connection && }
-
+
);
};
diff --git a/web/dialogs/AddTorrentDialog.tsx b/web/dialogs/AddTorrentDialog.tsx
index 1f5fe56..53a9e5f 100644
--- a/web/dialogs/AddTorrentDialog.tsx
+++ b/web/dialogs/AddTorrentDialog.tsx
@@ -1,4 +1,4 @@
-import type { ChangeEvent, DragEvent } from 'react';
+import type { ChangeEvent, DragEvent, FormEvent } from 'react';
import { useState } from 'react';
import { FileUp, Loader2, X } from 'lucide-react';
import { toast } from 'sonner';
@@ -98,7 +98,8 @@ export const AddTorrentDialog = ({ open, onOpenChange }: AddTorrentDialogProps)
const canSubmit = (files.length > 0 || urlList.length > 0) && !busy;
- const submit = async () => {
+ const submit = async (ev?: FormEvent) => {
+ ev?.preventDefault();
const common = {
downloadDir: downloadDir.trim() || undefined,
labels: labels
@@ -148,7 +149,7 @@ export const AddTorrentDialog = ({ open, onOpenChange }: AddTorrentDialogProps)
Paste magnet links or drop .torrent files.
-
-
-
-
-
+
+
+
+
+
);
diff --git a/web/dialogs/MoveTorrentDialog.tsx b/web/dialogs/MoveTorrentDialog.tsx
index 7c1c607..f75b153 100644
--- a/web/dialogs/MoveTorrentDialog.tsx
+++ b/web/dialogs/MoveTorrentDialog.tsx
@@ -1,4 +1,5 @@
import type { Torrent } from '../shared';
+import type { FormEvent } from 'react';
import { useEffect, useState } from 'react';
import { Button } from '@/components/ui/button';
import {
@@ -41,7 +42,8 @@ export const MoveTorrentDialog = ({ open, onOpenChange, targets, knownDirs }: Mo
setMove(true);
}, [open, targets]);
- const submit = async () => {
+ const submit = async (ev?: FormEvent) => {
+ ev?.preventDefault();
await setLocation.mutateAsync({ ids: targets.map((t) => t.id), location: location.trim(), move });
onOpenChange(false);
};
@@ -56,7 +58,7 @@ export const MoveTorrentDialog = ({ open, onOpenChange, targets, knownDirs }: Mo
-
-
-
-
-
+
+
+
+
+
);
diff --git a/web/dialogs/RenameDialog.tsx b/web/dialogs/RenameDialog.tsx
index f4dcdb7..7773c42 100644
--- a/web/dialogs/RenameDialog.tsx
+++ b/web/dialogs/RenameDialog.tsx
@@ -1,4 +1,5 @@
import type { Torrent } from '../shared';
+import type { FormEvent } from 'react';
import { useEffect, useState } from 'react';
import { Button } from '@/components/ui/button';
import {
@@ -38,7 +39,8 @@ export const RenameDialog = ({ open, onOpenChange, torrent, path }: RenameDialog
if (open) setName(current);
}, [open, current]);
- const submit = async () => {
+ const submit = async (ev?: FormEvent) => {
+ ev?.preventDefault();
if (!torrent) return;
await rename.mutateAsync({ id: torrent.id, path, name: name.trim() });
onOpenChange(false);
@@ -52,28 +54,22 @@ export const RenameDialog = ({ open, onOpenChange, torrent, path }: RenameDialog
{parent ? `${parent}/` : path}
-
-
-
-
-
+
+
+
+
+
);
diff --git a/web/dialogs/TorrentOptionsDialog.tsx b/web/dialogs/TorrentOptionsDialog.tsx
index 910ce3e..c48e570 100644
--- a/web/dialogs/TorrentOptionsDialog.tsx
+++ b/web/dialogs/TorrentOptionsDialog.tsx
@@ -1,4 +1,5 @@
import type { Torrent } from '../shared';
+import type { FormEvent } from 'react';
import { useEffect, useState } from 'react';
import { Button } from '@/components/ui/button';
import { Checkbox } from '@/components/ui/checkbox';
@@ -67,7 +68,8 @@ export const TorrentOptionsDialog = ({ open, onOpenChange, targets }: TorrentOpt
const patch = (next: Partial
) => setForm((prev) => (prev ? { ...prev, ...next } : prev));
- const submit = async () => {
+ const submit = async (ev?: FormEvent) => {
+ ev?.preventDefault();
await set.mutateAsync({
ids: targets.map((t) => t.id),
bandwidthPriority: Number(form.bandwidthPriority),
@@ -98,7 +100,7 @@ export const TorrentOptionsDialog = ({ open, onOpenChange, targets }: TorrentOpt
-
+
-
-
-
-
+
+
+
+
+
);