diff --git a/src/app/UserWrapper.tsx b/src/app/UserWrapper.tsx index cb4cdf8..110439c 100644 --- a/src/app/UserWrapper.tsx +++ b/src/app/UserWrapper.tsx @@ -12,6 +12,7 @@ import { makeStyles } from '@mui/styles' import { CssBaseline, Theme } from '@mui/material' import { AppThemeProvider } from 'theme/AppThemeProvider' import HTTPProvider from 'providers/http' +import { useSnackbar } from 'hooks' // import FirmwareLoader from './FirmwareLoader' const reducer = (state: GlobalState, action: GlobalStateAction): GlobalState => { @@ -64,6 +65,7 @@ export default function UserWrapper(props: Props) { const useAuth = useAuth0(); const hasFetched = useRef(false); const [global, setGlobal] = useState(undefined) + const snackbar = useSnackbar() const user_id = or(useAuth.user?.sub, "") @@ -81,7 +83,8 @@ export default function UserWrapper(props: Props) { backgroundTasksComplete: false, firmware: new Map() }) - }).catch(() => { + }).catch((err) => { + snackbar.error("get user and team: "+err) userAPI.getUser(user_id).then(user => { setGlobal({ user: user ? user : User.create(), @@ -92,7 +95,8 @@ export default function UserWrapper(props: Props) { backgroundTasksComplete: false, firmware: new Map() }) - }).catch(() => { + }).catch((err) => { + snackbar.error("get user: "+err) setGlobal(globalDefault) }) diff --git a/src/pages/Bins.tsx b/src/pages/Bins.tsx index 085d382..f17125e 100644 --- a/src/pages/Bins.tsx +++ b/src/pages/Bins.tsx @@ -199,6 +199,7 @@ export default function Bins(props: Props) { const [cardValDisplay, setCardValDisplay] = useState<"high" | "low" | "average">("high"); const [teamsDialog, setTeamsDialog] = useState(false) + const snackbar = useSnackbar() // const [scrollTranslations, setScrollTranslations] = useState({ // bins: 0, @@ -265,6 +266,8 @@ export default function Bins(props: Props) { // console.log("should?") setTeamsDialog(true) } + }).catch(err => { + snackbar.error("error listing teams: "+err) }) } }, [doneLoadingPage, grainBins, grainBags]) diff --git a/src/pages/Device.tsx b/src/pages/Device.tsx index 5acc7aa..9195c3d 100644 --- a/src/pages/Device.tsx +++ b/src/pages/Device.tsx @@ -158,9 +158,9 @@ export default function DevicePage() { if (length > 0) { warningString = warningString + " through " + getContextTypes()[length - 1]; } - snackbar.warning(warningString); + snackbar.warning("page data warning: "+warningString); } else { - snackbar.error(err); + snackbar.error("page data error: "+err); } }) .finally(() => setLoading(false)); @@ -174,7 +174,7 @@ export default function DevicePage() { } }) .catch(err => { - console.log(err) + console.log("load port scan: "+err) }) }