Skip to content

Commit

Permalink
add error checking and default version
Browse files Browse the repository at this point in the history
  • Loading branch information
bprize15 committed Dec 12, 2024
1 parent 7b5650c commit bbd4a09
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions web/src/main/javascript/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import "./app.scss";
import OncoTree, { OncoTreeNode } from "@oncokb/oncotree";
import { useCallback, useEffect, useState } from "react";
import "react-toastify/dist/ReactToastify.css";
import { Bounce, ToastContainer } from "react-toastify";
import { Bounce, toast, ToastContainer } from "react-toastify";
import News from "./pages/News/News";
import {
DEFAULT_VERSION,
ONCOTREE_TREE_URL,
PageRoutes,
} from "./shared/constants";
Expand All @@ -33,8 +34,10 @@ function App() {

useEffect(() => {
const version = searchParams.get('version');
if (version) {
fetchData(version);
try {
version ? fetchData(version) : fetchData(DEFAULT_VERSION);
} catch {
toast.error("Error fetching OncoTree data");
}
}, [searchParams]);

Expand Down

0 comments on commit bbd4a09

Please sign in to comment.