Skip to content

Commit

Permalink
Merge pull request #184 from VasylievYurii/fixingBugs4
Browse files Browse the repository at this point in the history
refreshing after getUserProfile
  • Loading branch information
VasylievYurii authored Nov 22, 2023
2 parents 2befe07 + cf7e595 commit fefb237
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/components/App/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import { selectUserProfileIsLoading } from '../../redux/selectors.js';
import { selectProductsIsLoading } from '../../redux/selectors.js';
import { selectMealsIsLoading } from '../../redux/selectors.js';
import { getUserProfile } from '../../redux/userProfile/userProfileOperations.js';
// import { getUserProfile } from '../redux/userProfile/userProfileOperations';

function App() {
const location = useLocation();
Expand All @@ -39,6 +38,7 @@ function App() {
await dispatch(getUserProfile());
};
fetchData();
dispatch(refreshUser());
}, [dispatch]);

const { profile } = useSelector((state) => state.profile);
Expand All @@ -49,9 +49,9 @@ function App() {

let isFilled = isLoggedIn && profile ? true : false;

useEffect(() => {
dispatch(refreshUser());
}, [dispatch]);
// useEffect(() => {
// dispatch(refreshUser());
// }, [dispatch]);

if (location.pathname === '/') {
return <Navigate to="/welcome" />;
Expand Down
1 change: 0 additions & 1 deletion src/redux/userProfile/userProfileOperations.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const getUserProfile = createAsyncThunk(
if (userToken) {
token.set(userToken);
const { data } = await instance.get('profiles');
console.log('data:', data);
return data;
}
return;
Expand Down

0 comments on commit fefb237

Please sign in to comment.