Refactor profile loading effect
cgen-add78cac0b7f4d31b999c96257319858
This commit is contained in:
parent
ba170e72f8
commit
57db40e7b3
1 changed files with 14 additions and 10 deletions
|
|
@ -89,17 +89,21 @@ export default function Admin() {
|
||||||
const [applicationsLoading, setApplicationsLoading] = useState(false);
|
const [applicationsLoading, setApplicationsLoading] = useState(false);
|
||||||
const [selectedMemberId, setSelectedMemberId] = useState<string | null>(null);
|
const [selectedMemberId, setSelectedMemberId] = useState<string | null>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
const loadProfiles = useCallback(async () => {
|
||||||
(async () => {
|
try {
|
||||||
try {
|
const list = await aethexUserService.listProfiles(200);
|
||||||
const list = await aethexUserService.listProfiles(50);
|
setManagedProfiles(list);
|
||||||
setManagedProfiles(list);
|
} catch (error) {
|
||||||
} catch (error) {
|
console.warn("Failed to load managed profiles:", error);
|
||||||
console.warn("Failed to load managed profiles:", error);
|
setManagedProfiles([]);
|
||||||
setManagedProfiles([]);
|
}
|
||||||
}
|
}, []);
|
||||||
})();
|
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
loadProfiles().catch(() => undefined);
|
||||||
|
}, [loadProfiles]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
fetch("/api/featured-studios")
|
fetch("/api/featured-studios")
|
||||||
.then((r) => (r.ok ? r.json() : []))
|
.then((r) => (r.ok ? r.json() : []))
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue