Merge branch 'task-20-feature/save_token_local' into 'development'

Task 20 feature/save token local

See merge request !6
parents eec5934c 7807ebef
......@@ -5,6 +5,7 @@ import App from './App';
import { configureStore } from '@reduxjs/toolkit';
import { Provider } from 'react-redux';
import usersReducer from './store/reducers/usersReducer';
import axios from 'axios';
const localStorageMiddleware = ({getState}) => (next) => (action) => {
const result = next(action);
......@@ -19,6 +20,13 @@ const loadFromLocalStorage = () => {
return undefined;
};
axios.interceptors.request.use(config=>{
try{
config.headers['Authorization']=store.getState().users.user.token;
} catch(e){
}
return config;
})
const store = configureStore({
reducer: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment