Skip to content

Commit

Permalink
fix: vault list fetch fixed (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
keriat authored Mar 2, 2023
1 parent 5be4582 commit 10ce1e1
Show file tree
Hide file tree
Showing 2 changed files with 2,824 additions and 19 deletions.
27 changes: 8 additions & 19 deletions src/components/VaultExplorer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import AtomTitle from "@/components/Atom/Title";
import Container from "@/components/Container";
import { scroller } from "react-scroll";
import { mapAddressWithScan, mapIcon } from "@/helpers/formatters";
import axios from "axios";
import { useMemo, useState } from "react";
import { BsSafe2Fill, BsChevronRight, BsChevronLeft } from "react-icons/bs";
import { FaFileContract } from "react-icons/fa";
import ReactPaginate from "react-paginate";
import vaultData from "@/content/vaults.json";

interface VaultType {
is_vault: boolean[];
Expand All @@ -29,25 +29,15 @@ const defaultState: VaultType = {
};

export default function VaultExplorer() {
const [vaults, setVaults] = useState(defaultState);
const [pageCount, setPageCount] = useState(0);
const [currentPage, setCurrentPage] = useState(1);
const [vaults, setVaults] = useState<VaultType>(defaultState);
const [pageCount, setPageCount] = useState<number>(0);
const [currentPage, setCurrentPage] = useState<number>(1);

const perPage = 15;

useMemo(() => {
let config = {
headers: {
"access-token": "superapi-testing",
},
};
axios
.get("//api.superform.xyz/explore/", config)
.then((res: any) => {
setVaults(res.data);
setPageCount(Math.ceil(res.data.timestamp.length / perPage));
})
.catch((_err: any) => {
// console.log(_err);
});
setVaults(vaultData as VaultType);
setPageCount(Math.ceil(vaultData.timestamp.length / perPage));
}, []);

/**
Expand All @@ -63,7 +53,6 @@ export default function VaultExplorer() {
offset: 60,
});
};
const perPage = 15;

return vaults === null ? null : (
<div
Expand Down
Loading

1 comment on commit 10ce1e1

@vercel
Copy link

@vercel vercel bot commented on 10ce1e1 Mar 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

sup-web-4626 – ./

erc4626.info
eip4626.com
sup-web-4626.superform.tech
sup-web-4626-git-main.superform.tech
*.eip4626.com

Please sign in to comment.