'use strict'; import 'whatwg-fetch'; import React from 'react'; export default class ConnectionStep extends React.Component { constructor (props) { super(props); } componentDidMount () { let interval; let done = false; let heartbeat = () => { window.fetch(`${this.props.baseApi}/heart`).then((res) => { if (res.ok && !done) { done = true; // prevent multiple request to trigger multiple nextStep window.clearInterval(interval); this.props.nextStep(); } }); }; interval = window.setInterval(heartbeat, 5 * 1000); heartbeat(); } render () { return (
Connect to your device Wi-Fi AP. If the AP is named Homie-1234abcd, the password is 1234abcd.