merged master and accepted both changes
This commit is contained in:
commit
1ed355d5a8
35 changed files with 2153 additions and 753 deletions
|
|
@ -13,6 +13,7 @@ import { CssBaseline, Theme } from '@mui/material'
|
|||
import { AppThemeProvider } from 'theme/AppThemeProvider'
|
||||
import HTTPProvider from 'providers/http'
|
||||
import { Crisp } from "crisp-sdk-web";
|
||||
import { useSnackbar } from 'hooks'
|
||||
// import FirmwareLoader from './FirmwareLoader'
|
||||
|
||||
const reducer = (state: GlobalState, action: GlobalStateAction): GlobalState => {
|
||||
|
|
@ -65,6 +66,7 @@ export default function UserWrapper(props: Props) {
|
|||
const useAuth = useAuth0();
|
||||
const hasFetched = useRef(false);
|
||||
const [global, setGlobal] = useState<undefined | GlobalState>(undefined)
|
||||
const snackbar = useSnackbar()
|
||||
|
||||
const user_id = or(useAuth.user?.sub, "")
|
||||
|
||||
|
|
@ -85,7 +87,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(),
|
||||
|
|
@ -96,7 +99,8 @@ export default function UserWrapper(props: Props) {
|
|||
backgroundTasksComplete: false,
|
||||
firmware: new Map()
|
||||
})
|
||||
}).catch(() => {
|
||||
}).catch((err) => {
|
||||
snackbar.error("get user: "+err)
|
||||
setGlobal(globalDefault)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue