Use API to load featured studios instead of localStorage
cgen-400701462b1c414bb5050385611f6fa2
This commit is contained in:
parent
7636ec23ab
commit
0eb081aa95
1 changed files with 5 additions and 8 deletions
|
|
@ -180,15 +180,12 @@ export default function GameDevelopment() {
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const [studios, setStudios] = useState<Studio[]>(defaultStudios);
|
const [studios, setStudios] = useState<Studio[]>([]);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
try {
|
fetch("/api/featured-studios")
|
||||||
const raw = localStorage.getItem("featured_studios");
|
.then((r) => (r.ok ? r.json() : []))
|
||||||
if (raw) {
|
.then((data) => Array.isArray(data) ? setStudios(data) : undefined)
|
||||||
const parsed = JSON.parse(raw);
|
.catch(() => undefined);
|
||||||
if (Array.isArray(parsed) && parsed.length) setStudios(parsed);
|
|
||||||
}
|
|
||||||
} catch {}
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const process = [
|
const process = [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue