home page hero section adjusted and google login success redirect implemented
This commit is contained in:
@@ -8,6 +8,7 @@ function Redirect() {
|
||||
const location = useLocation();
|
||||
const navigate = useNavigate();
|
||||
const userApi = new usersService();
|
||||
const dispatch = useDispatch()
|
||||
|
||||
const queryParams = new URLSearchParams(location?.search);
|
||||
const codeResponse = queryParams.get("code");
|
||||
@@ -37,19 +38,19 @@ function Redirect() {
|
||||
userApi
|
||||
.authStart(reqData)
|
||||
.then((res) => {
|
||||
console.log(res.data);
|
||||
if (res.status != 200 || res.internal_return < 0) {
|
||||
if (res.status != 200) {
|
||||
navigate('/login', {replace: true})
|
||||
return;
|
||||
}
|
||||
|
||||
localStorage.setItem("member_id", `${res.data.member_id}`);
|
||||
localStorage.setItem("uid", `${res.data.uid}`);
|
||||
localStorage.setItem("session_token", `${res.data.session}`);
|
||||
// localStorage.setItem("session", `${res.data.session}`);
|
||||
dispatch(updateUserDetails({...res.data, loggedIn:true}));
|
||||
|
||||
navigate('/', {replace: true})
|
||||
})
|
||||
.catch((error) => {
|
||||
navigate('/login', {replace: true})
|
||||
console.log(error);
|
||||
});
|
||||
},[])
|
||||
|
||||
Reference in New Issue
Block a user