import * as React from "react"; import * as System from "~/components/system"; import { LoaderSpinner } from "~/components/system/components/Loaders"; import Section from "~/components/core/Section"; import ScenePage from "~/components/core/ScenePage"; import ScenePageHeader from "~/components/core/ScenePageHeader"; let mounted = false; export default class SceneDeals extends React.Component { state = { deals: [], loaded: false }; async componentDidMount() { if (mounted) { return null; } mounted = true; let deals = []; try { const response = await fetch("/api/network-deals"); const json = await response.json(); deals = json.data.deals; } catch (e) {} if (!deals || !deals.length) { this.setState({ loaded: true }); return null; } this.setState({ deals, loaded: true }); } componentWillUnmount() { mounted = false; } render() { let addressSentence = "Your deals are made from your default address."; return ( View all of your storage deals that are in progress or successful. {addressSentence} {this.state.loaded ? (
) : (
)}
); } }