remove some wierdness

This commit is contained in:
Aria Moradi 2021-01-23 01:33:12 +03:30
parent dcdd50ffe1
commit 84676b9156
2 changed files with 4 additions and 12 deletions

View File

@ -6,7 +6,6 @@ export default function Extensions() {
const { setTitle } = useContext(NavBarTitle); const { setTitle } = useContext(NavBarTitle);
setTitle('Extensions'); setTitle('Extensions');
const [extensions, setExtensions] = useState<IExtension[]>([]); const [extensions, setExtensions] = useState<IExtension[]>([]);
let mapped;
useEffect(() => { useEffect(() => {
fetch('http://127.0.0.1:4567/api/v1/extension/list') fetch('http://127.0.0.1:4567/api/v1/extension/list')
@ -15,10 +14,7 @@ export default function Extensions() {
}, []); }, []);
if (extensions.length === 0) { if (extensions.length === 0) {
mapped = <h3>wait</h3>; return <h3>wait</h3>;
} else {
mapped = extensions.map((it) => <ExtensionCard extension={it} />);
} }
return <>{extensions.map((it) => <ExtensionCard extension={it} />)}</>;
return <h2>{mapped}</h2>;
} }

View File

@ -6,7 +6,6 @@ export default function Sources() {
const { setTitle } = useContext(NavBarTitle); const { setTitle } = useContext(NavBarTitle);
setTitle('Sources'); setTitle('Sources');
const [sources, setSources] = useState<ISource[]>([]); const [sources, setSources] = useState<ISource[]>([]);
let mapped;
useEffect(() => { useEffect(() => {
fetch('http://127.0.0.1:4567/api/v1/source/list') fetch('http://127.0.0.1:4567/api/v1/source/list')
@ -15,10 +14,7 @@ export default function Sources() {
}, []); }, []);
if (sources.length === 0) { if (sources.length === 0) {
mapped = <h3>wait</h3>; return (<h3>wait</h3>);
} else {
mapped = sources.map((it) => <SourceCard source={it} />);
} }
return <>{sources.map((it) => <SourceCard source={it} />)}</>;
return <h2>{mapped}</h2>;
} }