slate/pages/_/index.js

36 lines
833 B
JavaScript
Raw Normal View History

2020-07-16 08:48:51 +03:00
import * as React from "react";
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 {
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
}
}