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 [selectedMemberId, setSelectedMemberId] = useState<string | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
try {
|
||||
const list = await aethexUserService.listProfiles(50);
|
||||
setManagedProfiles(list);
|
||||
} catch (error) {
|
||||
console.warn("Failed to load managed profiles:", error);
|
||||
setManagedProfiles([]);
|
||||
}
|
||||
})();
|
||||
const loadProfiles = useCallback(async () => {
|
||||
try {
|
||||
const list = await aethexUserService.listProfiles(200);
|
||||
setManagedProfiles(list);
|
||||
} catch (error) {
|
||||
console.warn("Failed to load managed profiles:", error);
|
||||
setManagedProfiles([]);
|
||||
}
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
loadProfiles().catch(() => undefined);
|
||||
}, [loadProfiles]);
|
||||
|
||||
useEffect(() => {
|
||||
fetch("/api/featured-studios")
|
||||
.then((r) => (r.ok ? r.json() : []))
|
||||
.then((data) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue