Skip to content

Commit

Permalink
format files
Browse files Browse the repository at this point in the history
  • Loading branch information
bearpong committed Sep 23, 2024
1 parent 13e3fe8 commit f0831fc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 9 deletions.
29 changes: 22 additions & 7 deletions apps/honey/src/app/api/useHoneyEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,46 @@ export const useHoneyEvents = () => {
data: allData,
size: allDataSize,
setSize: setAllDataSize,
isLoading: isAllDataLoading
isLoading: isAllDataLoading,
} = useSWRInfinite(
(index) => ["allHoneyData", index],
(key) => fetchData(`${getAbsoluteUrl()}/api?page=${(key[1] ?? 0) + 1}&perPage=${DEFAULT_SIZE}`),
{ refreshInterval: POLLING.SLOW }
(key) =>
fetchData(
`${getAbsoluteUrl()}/api?page=${
(key[1] ?? 0) + 1
}&perPage=${DEFAULT_SIZE}`,
),
{ refreshInterval: POLLING.SLOW },
);

const {
data: mintData,
size: mintDataSize,
setSize: setMintDataSize,
isLoading: isMintDataLoading
isLoading: isMintDataLoading,
} = useSWRInfinite(
(index) => ["mintData", index],
(key) => fetchData(`${getAbsoluteUrl()}/api?page=${(key[1] ?? 0) + 1}&perPage=${DEFAULT_SIZE}&mint`)
(key) =>
fetchData(
`${getAbsoluteUrl()}/api?page=${
(key[1] ?? 0) + 1
}&perPage=${DEFAULT_SIZE}&mint`,
),
);

const {
data: burnData,
size: burnDataSize,
setSize: setBurnDataSize,
isLoading: isBurnDataLoading
isLoading: isBurnDataLoading,
} = useSWRInfinite(
(index) => ["burnData", index],
(key) => fetchData(`${getAbsoluteUrl()}/api?page=${(key[1] ?? 0) + 1}&perPage=${DEFAULT_SIZE}&burn`)
(key) =>
fetchData(
`${getAbsoluteUrl()}/api?page=${
(key[1] ?? 0) + 1
}&perPage=${DEFAULT_SIZE}&burn`,
),
);

const isAllDataLoadingMore =
Expand Down
6 changes: 5 additions & 1 deletion apps/honey/src/hooks/useHoneyEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ const generateHoneyDataFetcher = (query: any, txnType?: string) => {
return async (key: any[]) => {
const page = key[1];
try {
const variables = { page: page * DEFAULT_SIZE, limit: DEFAULT_SIZE, txnType };
const variables = {
page: page * DEFAULT_SIZE,
limit: DEFAULT_SIZE,
txnType,
};

const res = await honeyClient.query({
query,
Expand Down
6 changes: 5 additions & 1 deletion apps/honey/src/utils/graph-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ function fillData(
list: HoneyEntry[],
endUnix: number,
step: number,
typename: "HoneyVolumeHourData" | "HoneyVolumeDayData" | "HoneySupplyHourData" | "HoneySupplyDayData"
typename:
| "HoneyVolumeHourData"
| "HoneyVolumeDayData"
| "HoneySupplyHourData"
| "HoneySupplyDayData",
) {
const data = [...list];
const timeList = generateTimestamps(endUnix + step, step);
Expand Down

0 comments on commit f0831fc

Please sign in to comment.