@@ -90,7 +90,7 @@ export default function (
9090 firstname = '' ,
9191 lastname = '' ,
9292 } ,
93- } = action . payload ;
93+ } = action ;
9494
9595 return {
9696 ...state ,
@@ -203,7 +203,7 @@ function logUser(
203203 return async ( dispatch ) => {
204204 try {
205205 let actionTime = format ( new Date ( ) , 'dd/MM/yyyy HH:MM' ) ;
206- dispatch ( { type : REQUEST_LOG_USER , actionTime } ) ;
206+ dispatch ( { type : REQUEST_LOG_USER , actionTime, login , password } ) ;
207207
208208 // #region mocked request case:
209209 actionTime = format ( new Date ( ) , 'dd/MM/yyyy HH:MM' ) ;
@@ -212,7 +212,7 @@ function logUser(
212212 dispatch ( {
213213 type : RECEIVED_LOG_USER ,
214214 actionTime,
215- payload : user ,
215+ data : user ,
216216 } ) ;
217217
218218 return user ;
@@ -239,13 +239,17 @@ function logUser(
239239 dispatch ( {
240240 type : RECEIVED_LOG_USER ,
241241 actionTime,
242- payload : data ,
242+ data,
243243 } ) ;
244244 return data ;
245245 // #endregion
246- } catch ( error ) {
246+ } catch ( error : any ) {
247247 const actionTime = format ( new Date ( ) , 'dd/MM/yyyy HH:MM' ) ;
248- dispatch ( { type : ERROR_LOG_USER , actionTime } ) ;
248+ dispatch ( {
249+ type : ERROR_LOG_USER ,
250+ actionTime,
251+ error : error ?. message ?? 'undefined error, no luck bro' ,
252+ } ) ;
249253 }
250254 } ;
251255}
@@ -273,7 +277,7 @@ export function logUserIfNeeded(
273277function shouldLogUser ( state : RootState , userEmail : string ) : boolean {
274278 const { isLogging, login : currentUserEmail } = state . userAuth ;
275279
276- if ( currentUserEmail !== userEmail ) {
280+ if ( ! currentUserEmail || currentUserEmail !== userEmail ) {
277281 return true ;
278282 }
279283
0 commit comments