Skip to content

Commit

Permalink
Fix loading issue
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorsharp committed Jan 9, 2025
1 parent 1063dc9 commit 40aaa5a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/components/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,14 @@ const MainPage = ({ initialFeedId }: MainPageProps) => {
const [sourceFeedData, setSourceFeedData] = useState<FeedData | undefined>(undefined);

useEffect(() => {
setLoading(true);
fetch(`/api/mod-config/${initialFeedId}`)
.then((response) => response.json())
.then((data) => modConfigSchema.parse(data))
.then((initialModConfig) => setModConfig(initialModConfig))
.catch(() => router.push("/"));
if (initialFeedId) {
setLoading(true);
fetch(`/api/mod-config/${initialFeedId}`)
.then((response) => response.json())
.then((data) => modConfigSchema.parse(data))
.then((initialModConfig) => setModConfig(initialModConfig))
.catch(() => router.push("/"));
}
}, [initialFeedId]);

useEffect(() => {
Expand Down

0 comments on commit 40aaa5a

Please sign in to comment.