google login
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { useLocation, useNavigate } from 'react-router-dom';
|
import { useLocation, useNavigate } from 'react-router-dom';
|
||||||
import usersService from '../../../services/UsersService';
|
import usersService from '../../../services/UsersService';
|
||||||
|
import {updateUserDetails} from "../../../store/UserDetails";
|
||||||
|
import { useDispatch } from "react-redux";
|
||||||
|
|
||||||
function Redirect() {
|
function Redirect() {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
@@ -40,11 +42,12 @@ function Redirect() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
userApi.CompleteOauthLogin(res.data).then( (logRes)=>{
|
localStorage.setItem("member_id", `${res.data.member_id}`);
|
||||||
console.log("OUATH FROm BACKEND",logRes);
|
localStorage.setItem("uid", `${res.data.uid}`);
|
||||||
} )
|
localStorage.setItem("session_token", `${res.data.session}`);
|
||||||
// "{"message":"Endpoint not found.","URI":"http:\/\/localhost:9083\/index.php\/en\/wrench\/api\/v1\/authstart"}[]"
|
// localStorage.setItem("session", `${res.data.session}`);
|
||||||
//alert(JSON.stringify(res.data));
|
dispatch(updateUserDetails({...res.data, loggedIn:true}));
|
||||||
|
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
|
|||||||
Reference in New Issue
Block a user