mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-07-03 02:44:34 -05:00
better messages, axios client
This commit is contained in:
@@ -10,15 +10,17 @@ export default function Sources() {
|
||||
const { setTitle } = useContext(NavBarTitle);
|
||||
setTitle('Sources');
|
||||
const [sources, setSources] = useState<ISource[]>([]);
|
||||
const [fetched, setFetched] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
fetch('http://127.0.0.1:4567/api/v1/source/list')
|
||||
.then((response) => response.json())
|
||||
.then((data) => setSources(data));
|
||||
.then((data) => { setSources(data); setFetched(true); });
|
||||
}, []);
|
||||
|
||||
if (sources.length === 0) {
|
||||
return (<h3>wait</h3>);
|
||||
if (fetched) return (<h3>No sources found. Install Some Extensions first.</h3>);
|
||||
return (<h3>loading...</h3>);
|
||||
}
|
||||
return <>{sources.map((it) => <SourceCard source={it} />)}</>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user