fix(Redux): fix the presisted redux store.

This commit is contained in:
a.bouhuolia
2021-03-20 22:25:36 +02:00
parent cd2e93743e
commit adb65b04da
4 changed files with 23 additions and 12 deletions

View File

@@ -1,6 +1,7 @@
import { useMutation } from 'react-query';
import useApiRequest from '../useRequest';
import { useAuthActions } from '../state';
import { persistor } from 'store/createStore';
/**
* Authentication login.
@@ -15,6 +16,9 @@ export const useAuthLogin = (props) => {
select: (res) => res.data,
onSuccess: (data) => {
setLogin(data.data);
// Run the store persist.
persistor.persist();
},
...props
}

View File

@@ -3,10 +3,8 @@ import { useCallback } from 'react';
import { isAuthenticated } from 'store/authentication/authentication.reducer';
import {
setLogin,
setLogout,
setStoreReset,
} from 'store/authentication/authentication.actions';
import { purgePersistedState } from 'store/createStore';
import { useQueryClient } from 'react-query';
export const useAuthActions = () => {