File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed
Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ const getPercentageRatio = (v) => {
8686}
8787
8888const getSectorName = (item ) => {
89- return item .time ? DateTime .fromISO (item .time ).hour : DateTime .now ().hour
89+ return item? .time ? DateTime .fromISO (item? .time ).hour : DateTime .now ().hour
9090}
9191< / script>
9292
Original file line number Diff line number Diff line change @@ -74,23 +74,47 @@ export const fetchLatestBlocks = async ({ limit }) => {
7474 }
7575}
7676
77+ // export const fetchAvgBlockTime = async ({ from }) => {
78+ // try {
79+ // const url = new URL(`${useServerURL()}/stats/summary/block_stats/avg?column=block_time`)
80+
81+ // url.searchParams.append("from", from)
82+
83+ // const data = await useFetch(url.href)
84+ // return data
85+ // } catch (error) {
86+ // console.error(error)
87+ // }
88+ // }
89+
90+ // export const fetchBlockByHeight = async (height) => {
91+ // try {
92+ // const data = await useFetch(`${useServerURL()}/block/${height}?stats=true`)
93+ // return data
94+ // } catch (error) {
95+ // console.error(error)
96+ // }
97+ // }
98+
7799export const fetchAvgBlockTime = async ( { from } ) => {
78100 try {
79101 const url = new URL ( `${ useServerURL ( ) } /stats/summary/block_stats/avg?column=block_time` )
80102
81103 url . searchParams . append ( "from" , from )
82104
83- const data = await useFetch ( url . href )
84- return data
105+ return useFetch ( url . href , {
106+ key : "avg_block_time" ,
107+ } )
85108 } catch ( error ) {
86109 console . error ( error )
87110 }
88111}
89112
90113export const fetchBlockByHeight = async ( height ) => {
91114 try {
92- const data = await useFetch ( `${ useServerURL ( ) } /block/${ height } ?stats=true` )
93- return data
115+ return useFetch ( `${ useServerURL ( ) } /block/${ height } ?stats=true` , {
116+ key : "block" ,
117+ } )
94118 } catch ( error ) {
95119 console . error ( error )
96120 }
You can’t perform that action at this time.
0 commit comments