File tree Expand file tree Collapse file tree
src/sections/General/Navigation Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,6 +187,9 @@ const Navigation = () => {
187187 const fetchData = async ( ) => {
188188 try {
189189 const token = getCookieValue ( "provider_token" ) ;
190+ if ( ! token ) { // no token: don't proceed
191+ return ;
192+ }
190193 const response = await axios . get ( CLOUD_USER_API , {
191194 headers : {
192195 Authorization : `Bearer ${ token } ` ,
@@ -200,7 +203,12 @@ const Navigation = () => {
200203 const data = response . data ;
201204 setUserData ( data ) ;
202205 } catch ( error ) {
203- console . error ( "There was a problem with your fetch operation:" , error ) ;
206+ if ( error ?. response ?. status === 401 ) {
207+ // unauthorized token
208+ } else {
209+ // only for debugging purposes, no need to log
210+ // console.error("There was a problem with your fetch operation:", error);
211+ }
204212 }
205213 } ;
206214
You can’t perform that action at this time.
0 commit comments