mirror of
https://github.com/yzernik/squeaknode.git
synced 2026-08-18 13:09:08 +02:00
Get squeaks for address in frontend (#109)
This commit is contained in:
parent
cb282d9af3
commit
0d37000ce5
2 changed files with 26 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import React from "react";
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { Grid } from "@material-ui/core";
|
||||
|
||||
|
|
@ -10,9 +10,33 @@ import PageTitle from "../../components/PageTitle";
|
|||
import Widget from "../../components/Widget";
|
||||
import { Typography } from "../../components/Wrappers";
|
||||
|
||||
import { GetAddressSqueakDisplaysRequest } from "../../proto/squeak_admin_pb"
|
||||
import { SqueakAdminClient } from "../../proto/squeak_admin_grpc_web_pb"
|
||||
|
||||
var client = new SqueakAdminClient('http://' + window.location.hostname + ':8080')
|
||||
|
||||
export default function SqueakAddressPage() {
|
||||
var classes = useStyles();
|
||||
const { id } = useParams();
|
||||
const [squeaks, setSqueaks] = useState([]);
|
||||
|
||||
const getSqueaks = () => {
|
||||
console.log("called getSqueaks");
|
||||
|
||||
var getSqueaksRequest = new GetAddressSqueakDisplaysRequest()
|
||||
getSqueaksRequest.setAddress(id);
|
||||
console.log(getSqueaksRequest);
|
||||
|
||||
client.getAddressSqueakDisplays(getSqueaksRequest, {}, (err, response) => {
|
||||
console.log(response);
|
||||
console.log(response.getSqueakDisplayEntriesList());
|
||||
// console.log(response.getSqueakDisplayEntriesList(),length);
|
||||
setSqueaks(response.getSqueakDisplayEntriesList())
|
||||
});
|
||||
};
|
||||
useEffect(()=>{
|
||||
getSqueaks()
|
||||
},[]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
@ -20,6 +44,7 @@ export default function SqueakAddressPage() {
|
|||
<Grid container spacing={4}>
|
||||
<div>
|
||||
Hello!
|
||||
Number of squeaks for address: {squeaks.length}
|
||||
</div>
|
||||
</Grid>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -107,7 +107,6 @@ class SqueakAdminServerServicer(squeak_admin_pb2_grpc.SqueakAdminServicer):
|
|||
block_header = squeak_entry.block_header
|
||||
is_unlocked = squeak.HasDecryptionKey()
|
||||
content_str = squeak.GetDecryptedContentStr() if is_unlocked else None
|
||||
logger.info("Got block_header: {}".format(block_header))
|
||||
return squeak_admin_pb2.SqueakDisplayEntry(
|
||||
squeak_hash=get_hash(squeak).hex(),
|
||||
is_unlocked=squeak.HasDecryptionKey(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue