diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 0d49956..21f6651 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -60,6 +60,7 @@ function App() { const [categoryForm, setCategoryForm] = useState({ name: '', icon: 'folder', color: '#667eea', sort_order: 0 }) const [editingCategory, setEditingCategory] = useState(null) const [loading, setLoading] = useState(true) + const [saving, setSaving] = useState(false) const [websiteForm, setWebsiteForm] = useState({ name: '', url: '', icon: '', description: '', category_id: '', is_favorite: false }) useEffect(() => { loadData() }, []) @@ -113,6 +114,8 @@ function App() { } const saveCategory = async () => { + if (saving) return + setSaving(true) try { const payload = { name: categoryForm.name, @@ -128,7 +131,9 @@ function App() { setCategoryForm({ name: '', icon: 'folder', color: '#667eea', sort_order: 0 }) setEditingCategory(null) loadData() - } catch (e) { console.error(e) } + } catch (e) { console.error(e) } finally { + setSaving(false) + } } const deleteCategory = async (id) => { @@ -142,6 +147,8 @@ function App() { // 保存网站 const handleWebsiteSubmit = async () => { + if (saving) return + setSaving(true) try { const payload = { ...websiteForm, category_id: websiteForm.category_id || null } if (modal.data) { @@ -151,7 +158,9 @@ function App() { } closeModal() loadData() - } catch (e) {} + } catch (e) {} finally { + setSaving(false) + } } const handleDeleteWebsite = async (id) => { @@ -315,8 +324,8 @@ function App() {
- - + +
@@ -360,8 +369,8 @@ function App() {
- - +