2020-07-16 08:48:51 +03:00
|
|
|
import * as React from "react";
|
|
|
|
|
2020-07-29 19:07:13 +03:00
|
|
|
import Application from "~/components/core/Application";
|
2020-07-16 08:48:51 +03:00
|
|
|
|
2020-08-19 21:17:12 +03:00
|
|
|
export const getServerSideProps = async ({ query, res }) => {
|
|
|
|
let json = null;
|
|
|
|
try {
|
|
|
|
const response = await fetch("https://hub.textile.io/health", {
|
|
|
|
headers: {
|
|
|
|
Accept: "application/json",
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
},
|
|
|
|
});
|
|
|
|
json = await response.json();
|
|
|
|
} catch (e) {
|
|
|
|
console.log(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO(jim): Do something more robust here.
|
|
|
|
if (json) {
|
|
|
|
console.log(json);
|
|
|
|
} else {
|
|
|
|
return res.redirect("/maintenance");
|
|
|
|
}
|
|
|
|
|
2020-07-16 08:48:51 +03:00
|
|
|
return {
|
2020-08-14 12:17:19 +03:00
|
|
|
props: { viewer: query.viewer, analytics: query.analytics },
|
2020-07-16 08:48:51 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export default class ApplicationPage extends React.Component {
|
|
|
|
render() {
|
2020-08-19 21:17:12 +03:00
|
|
|
return <Application viewer={this.props.viewer} analytics={this.props.analytics} />;
|
2020-07-16 08:48:51 +03:00
|
|
|
}
|
|
|
|
}
|