feat: use new db site, cache requests to avoid repeated unneeded fetch calls

This commit is contained in:
2026-06-18 23:20:12 -03:00
parent 9f5b8cd1fa
commit 6a064d295e
8 changed files with 64 additions and 35 deletions
+6 -7
View File
@@ -7,6 +7,7 @@ import shared from '../../styles/shared.module.css';
import styles from '../../styles/Customizations.module.css';
import { getFileName, cleanFolderName, isKiller } from '../../lib/utils';
import { fetchCharacters, fetchCustomizations } from '../../lib/db';
import { Character, CustomizationItem, RoleFilter, Tab, TAB_CATEGORIES, CATEGORY_ORDER } from './types';
import CharacterPicker from './CharacterPicker';
import CharacterCosmetics from './CharacterCosmetics';
@@ -31,13 +32,11 @@ export default function CustomizationsPage() {
const [page, setPage] = useState(1);
useEffect(() => {
Promise.all([
fetch('/data/customization_items.json').then(r => r.json()).catch(() => []),
fetch('/data/characters.json').then(r => r.json()).catch(() => []),
]).then(([items, chars]) => {
setAllItems(items);
setCharacters(chars);
});
Promise.all([fetchCustomizations(), fetchCharacters()])
.then(([items, chars]) => {
setAllItems(items);
setCharacters(chars);
});
}, []);
useEffect(() => { setPage(1); }, [tab, search]);