Skip to content

Commit

Permalink
fix: reload loop on signup
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodressel committed Jan 29, 2024
1 parent 687e651 commit 88eab51
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/context/SuperheroProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,19 @@ import { communityBotAtom, minimumTokenThresholdAtom, verifiedAccountsAtom, veri

const useMinimumTokenThreshold = (config: any): void => {
const [, setMinimumTokenThreshold] = useAtom(minimumTokenThresholdAtom);
const [isLoading, setIsLoading] = React.useState(false);

const loadMinimumTokenThreshold = useCallback(() => {
if (config.bots_backend_url && !isLoading) {
setIsLoading(true);
if (config.bots_backend_url) {
fetch(`${config.bots_backend_url}/ui/minimum-token-threshold`, {
method: "GET",
})
.then((res) => res.json())
.then(setMinimumTokenThreshold)
.catch((e) => {
console.error("Error loading minimum token threshold", e);
})
.finally(() => {
setIsLoading(false);
});
}
}, [config.bots_backend_url, isLoading, setMinimumTokenThreshold]);
}, [setMinimumTokenThreshold, config.bots_backend_url]);

useEffect(() => {
loadMinimumTokenThreshold();
Expand Down

0 comments on commit 88eab51

Please sign in to comment.