fix: Resolve ESLint errors in Settings page (useEffect deps)

This commit is contained in:
Dương Cầm
2026-01-25 14:58:18 +07:00
parent 8a008be293
commit e583848c1c

View File

@@ -20,16 +20,15 @@ function ItemTypeManager() {
const [newLabel, setNewLabel] = useState("");
const [loading, setLoading] = useState(false);
const loadItemTypes = async () => {
try {
const res = await getItemTypes();
setItemTypes(res);
} catch {
// Silently ignore errors
}
};
useEffect(() => {
const loadItemTypes = async () => {
try {
const res = await getItemTypes();
setItemTypes(res);
} catch {
// Silently ignore errors
}
};
loadItemTypes();
}, []);
@@ -140,27 +139,18 @@ export default function SettingsPage() {
const [importFile, setImportFile] = useState<File | null>(null);
const [clearBeforeImport, setClearBeforeImport] = useState(false);
const loadBrands = async () => {
try {
const res = await getBrands();
setBrandsList(res);
} catch {
// Silently ignore errors
}
};
const loadApiKeys = async () => {
try {
const res = await getApiKeys();
setApiKeys(res);
} catch {
// Silently ignore errors
}
};
useEffect(() => {
loadBrands();
loadApiKeys();
const fetchData = async () => {
try {
const brands = await getBrands();
setBrandsList(brands);
} catch { }
try {
const keys = await getApiKeys();
setApiKeys(keys);
} catch { }
};
fetchData();
}, []);
// ... inside component
@@ -177,9 +167,7 @@ export default function SettingsPage() {
try {
const res = await getTemplates();
setTemplates(res);
} catch {
// Silently ignore errors
}
} catch { }
};
useEffect(() => {