cambio ingreso
This commit is contained in:
parent
3b7faaae03
commit
77058335a3
|
|
@ -100,8 +100,8 @@ const useJwtAuth = <User, SignInPayload, SignUpPayload>(
|
|||
/**
|
||||
* Handle sign-in success
|
||||
*/
|
||||
const handleSignInSuccess = useCallback((userData: User) => {
|
||||
// setSession(accessToken);
|
||||
const handleSignInSuccess = useCallback((userData: User, accessToken) => {
|
||||
setSession(accessToken);
|
||||
|
||||
setIsAuthenticated(true);
|
||||
|
||||
|
|
@ -188,7 +188,7 @@ const useJwtAuth = <User, SignInPayload, SignUpPayload>(
|
|||
|
||||
const userData = response?.data;
|
||||
|
||||
handleSignInSuccess(userData);
|
||||
handleSignInSuccess(userData, accessToken);
|
||||
|
||||
return true;
|
||||
} catch (error) {
|
||||
|
|
@ -222,8 +222,8 @@ const useJwtAuth = <User, SignInPayload, SignUpPayload>(
|
|||
* Sign in
|
||||
*/
|
||||
const signIn = async (credentials: UserLogin) => {
|
||||
// const response = axios.post(authConfig.signInUrl, credentials);
|
||||
const {error, bodyOut} = await loginIn(credentials.email, credentials.password);
|
||||
const response = axios.post(authConfig.signInUrl, credentials);
|
||||
/* const {error, bodyOut} = await loginIn(credentials.email, credentials.password);
|
||||
|
||||
if(error.codigo === '0'){
|
||||
const userData = bodyOut.data[0];
|
||||
|
|
@ -232,8 +232,8 @@ const useJwtAuth = <User, SignInPayload, SignUpPayload>(
|
|||
|
||||
}
|
||||
|
||||
return bodyOut.data[0];
|
||||
/* response.then(
|
||||
return bodyOut.data[0]; */
|
||||
response.then(
|
||||
(res: AxiosResponse<{ user: User; access_token: string }>) => {
|
||||
const userData = res?.data?.user;
|
||||
const accessToken = res?.data?.access_token;
|
||||
|
|
@ -249,7 +249,7 @@ const useJwtAuth = <User, SignInPayload, SignUpPayload>(
|
|||
|
||||
return axiosError;
|
||||
}
|
||||
); */
|
||||
);
|
||||
|
||||
// return response;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue