File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,3 +32,7 @@ export function getConfig() {
3232 }
3333 return config ;
3434}
35+
36+ export function isNotProduction ( ) {
37+ return ! ! process . env . DEBUG || ! process . env . NODE_ENV || process . env . NODE_ENV !== 'production' ;
38+ }
Original file line number Diff line number Diff line change @@ -28,5 +28,5 @@ export function isSerializedError(error: any): error is SerializedError {
2828}
2929
3030export function isFetchBaseQueryError ( error : any ) : error is FetchBaseQueryError {
31- return 'data' in error && 'status' in error ;
31+ return 'data' in error && 'status' in error && typeof error . data === 'object' ;
3232}
Original file line number Diff line number Diff line change 1- import { getConfig } from '../../app/config' ;
1+ import { FetchBaseQueryError } from '@reduxjs/toolkit/dist/query' ;
2+ import { getConfig , isNotProduction } from '../../app/config' ;
23import { useAuth } from '../../hooks/useAuth' ;
34import Container from '@mui/material/Container' ;
45import CssBaseline from '@mui/material/CssBaseline' ;
@@ -9,7 +10,6 @@ import Button from '@mui/material/Button';
910import LockOutlinedIcon from '@mui/icons-material/LockOutlined' ;
1011import GitHubIcon from '@mui/icons-material/GitHub' ;
1112import Alert from '@mui/material/Alert' ;
12- import { useAuth } from '../../hooks/useAuth' ;
1313
1414const { githubClientId } = getConfig ( ) ;
1515
@@ -30,7 +30,9 @@ export default function Login() {
3030 >
3131 { error && (
3232 < Alert severity = "error" sx = { { m : 3 } } >
33- { JSON . stringify ( error ) }
33+ { isNotProduction ( )
34+ ? JSON . stringify ( error )
35+ : ( ( error as FetchBaseQueryError ) ?. data as Record < string , any > ) ?. message }
3436 </ Alert >
3537 ) }
3638
You can’t perform that action at this time.
0 commit comments