File tree Expand file tree Collapse file tree
entregable4-frontend-2-main/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,12 +24,26 @@ const Login = () => {
2424 } ) ) ;
2525 navigate ( '/users/all_users' ) ;
2626 } catch ( error ) {
27+ const status = error . response ?. status
28+ if ( status === 401 ) {
29+ dispatch ( showNotification ( {
30+ variant : "danger" ,
31+ message : "Invalid credentials" ,
32+ } ) )
33+ } else {
34+ dispatch ( showNotification ( {
35+ variant : "danger" ,
36+ message : "Unexpected error, please try again" ,
37+ } ) )
38+ }
39+
40+ /*catch (error) {
2741 if(error.response.status === 401) {
2842 dispatch(showNotification({
2943 variant: "danger",
3044 message: "Invalid credentials",
3145 }));
32- }
46+ }*/
3347 } finally { setIsLoading ( false ) ; }
3448 }
3549
@@ -49,7 +63,7 @@ const Login = () => {
4963 </ Form . Text >
5064 </ Form . Group >
5165
52- < Form . Group className = "mb-5" controlId = "passworrd " >
66+ < Form . Group className = "mb-5" controlId = "password " >
5367 < Form . Label > Password</ Form . Label >
5468 < Form . Control
5569 type = "password"
Original file line number Diff line number Diff line change @@ -8,9 +8,14 @@ const axios = axiosOriginal.create({
88
99axios . interceptors . request . use ( function ( config ) {
1010 const token = store . getState ( ) . auth . token ;
11- if ( config . headers ?. Authorization ) return config ;
12- config . headers . Authorization = `Bearer ${ token } ` ;
11+ if ( token ) {
12+ config . headers . Authorization = `Bearer ${ token } ` ;
13+ }
1314 return config ;
15+
16+ /*if(config.headers?.Authorization) return config;
17+ config.headers.Authorization = `Bearer ${token}`;
18+ return config;*/
1419} ) ;
1520
1621axios . interceptors . response . use ( ( res ) => {
You can’t perform that action at this time.
0 commit comments