Merge pull request #157 from filecoin-project/@colin/analytics-api-integration

Analytics API integration
This commit is contained in:
CAKE 2020-08-16 22:30:41 -07:00 committed by GitHub
commit 41ef4c3e2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 3 deletions

View File

@ -2,6 +2,7 @@ export const POLLING_RATE = 5000;
export const POWERGATE_HOST = "https://grpcweb.slate.textile.io";
export const FILE_STORAGE_URL = "./public/static/files/";
export const GITHUB_URL = "https://github.com/filecoin-project/slate";
export const ANALYTICS_URL = "https://slate-stats-dev.azurewebsites.net/";
// NOTE(jim): 1 GB from Ignacio
export const TEXTILE_ACCOUNT_BYTE_LIMIT = 1073741824;

View File

@ -4,8 +4,11 @@ import * as Powergate from "~/node_common/powergate";
import * as Constants from "~/node_common/constants";
export const get = async () => {
const analytics = {};
// Current endpoints available for consumption
// Endpoints: blocks, blockParents, blockRewards, blockMessages, receipts, messages
const endpoint = "blocks";
const response = await fetch(Constants.ANALYTICS_URL + endpoint);
const analytics = response.json();
// TODO(colin): We can bind Analytics here on the server.
return analytics;
};

View File

@ -10,6 +10,11 @@ export const getServerSideProps = async ({ query }) => {
export default class ApplicationPage extends React.Component {
render() {
return <Application viewer={this.props.viewer} analytics={this.props.analytics} />;
return (
<Application
viewer={this.props.viewer}
analytics={this.props.analytics}
/>
);
}
}