File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/sections/General/Navigation Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -187,6 +187,9 @@ const Navigation = () => {
187
187
const fetchData = async ( ) => {
188
188
try {
189
189
const token = getCookieValue ( "provider_token" ) ;
190
+ if ( ! token ) { // no token: don't proceed
191
+ return ;
192
+ }
190
193
const response = await axios . get ( CLOUD_USER_API , {
191
194
headers : {
192
195
Authorization : `Bearer ${ token } ` ,
@@ -200,7 +203,12 @@ const Navigation = () => {
200
203
const data = response . data ;
201
204
setUserData ( data ) ;
202
205
} 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
+ }
204
212
}
205
213
} ;
206
214
You can’t perform that action at this time.
0 commit comments