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(() => {
|
||||
try {
|
||||
const raw = localStorage.getItem("featured_studios");
|
||||
if (raw) {
|
||||
const parsed = JSON.parse(raw);
|
||||
if (Array.isArray(parsed) && parsed.length) setStudios(parsed);
|
||||
}
|
||||
} catch {}
|
||||
fetch("/api/featured-studios")
|
||||
.then((r) => (r.ok ? r.json() : []))
|
||||
.then((data) => Array.isArray(data) ? setStudios(data) : undefined)
|
||||
.catch(() => undefined);
|
||||
}, []);
|
||||
|
||||
const process = [
|
||||
|
|
|
|||
Loading…
Reference in a new issue