Skip to content

Commit

Permalink
add getter for list of measurements
Browse files Browse the repository at this point in the history
  • Loading branch information
vol4tim committed Aug 21, 2024
1 parent b38ad2a commit bf16b5b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/providers/remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ class Provider {
});
}

static async getMeasurements(start, end) {
try {
const result = await api.get(`/measurements/${start}/${end}`);
return result.data.result;
} catch {
return [];
}
}

watch(cb) {
if (cb) {
this.socket.on("update", (result) => {
Expand Down
7 changes: 7 additions & 0 deletions src/views/Main.vue
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,13 @@ export default {
} else {
this.providerObj = new providers.Libp2p(config.LIBP2P);
}
const result = await providers.Remote.getMeasurements(
moment().startOf("day").format("X"),
moment().format("X")
);
console.log(result);
this.providerObj.ready().then(() => {
this.providerReady = true;
this.providerObj.watch(this.handlerNewPoint);
Expand Down

0 comments on commit bf16b5b

Please sign in to comment.