diff --git a/src/contexts/JWTContext.js b/src/contexts/JWTContext.js index 47ea5e5..420518f 100755 --- a/src/contexts/JWTContext.js +++ b/src/contexts/JWTContext.js @@ -29,6 +29,8 @@ const verifyToken = (accessToken) => { return false; } const decoded = jwtDecode(accessToken); + console.log(decoded); + /** * Property 'exp' does not exist on type '(token, options?: JwtDecodeOptions | undefined) => T'. */ @@ -60,6 +62,7 @@ export const JWTProvider = ({ children }) => { if (accessToken && verifyToken(accessToken)) { setLocalStorage(ACCESS_TOKEN_NAME, accessToken); const response = await axios.get('/api/v1/ctgy/user'); + console.log(response); const { userid, email, name } = response.data; dispatch({ type: LOGIN, diff --git a/src/menu-items/dashboard.js b/src/menu-items/dashboard.js index ba01d44..65f5fc0 100755 --- a/src/menu-items/dashboard.js +++ b/src/menu-items/dashboard.js @@ -23,7 +23,7 @@ const dashboard = { type: 'item', url: '/dashboard/default', icon: icons.IconDashboard, - breadcrumbs: true + breadcrumbs: false }, { id: 'analytics', @@ -31,7 +31,7 @@ const dashboard = { type: 'item', url: '/dashboard/analytics', icon: icons.IconDeviceAnalytics, - breadcrumbs: true + breadcrumbs: false } ] }; diff --git a/src/utils/axios.js b/src/utils/axios.js index 6ee200e..59819a0 100755 --- a/src/utils/axios.js +++ b/src/utils/axios.js @@ -26,30 +26,30 @@ const axiosService = axios.create({ */ // const alertError = (config: AxiosRequestConfig, request: any, response: AxiosResponse, error: Error) => { const alertError = (config, request, response, error) => { - if (error.isAxiosError) { - let errMsg = `시스템 에러~~~~~~~~~~~~`; - if (error.code === 'ECONNABORTED') errMsg = 'Server time out'; + if (response && response.data) { + const errCode = response.data.code || response.data.status; + const errMsg = response.data.code != '' && response.data.code != null ? response.data.message : response.data.error; + console.error(`${errCode}: ${errMsg}`); + console.error('================================='); + + // Alert.error(`${errCode}: ${errMsg}`); Swal.fire({ icon: 'error', title: 'Api Error', - html: errMsg, + html: `${errMsg} [ ${errCode} ]`, // imageUrl: timer: 5000 }).then((r) => r); return; } - if (response) { - const errCode = response.data.code; - const errMsg = response.data.error; - console.error(`${errCode}: ${errMsg}`); - console.error('================================='); - - // Alert.error(`${errCode}: ${errMsg}`); + if (error.isAxiosError) { + let errMsg = `시스템 에러~~~~~~~~~~~~`; + if (error.code === 'ECONNABORTED') errMsg = 'Server time out'; Swal.fire({ icon: 'error', title: 'Api Error', - html: `${errCode}: ${errMsg}`, + html: errMsg, // imageUrl: timer: 5000 }).then((r) => r);