mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
5ea9115a95
* Authentication middleware * API client refactor * Configure API client to make forgot_password requests * Successfully submit forgot password form * Display server errors for unknown email address
17 lines
441 B
JavaScript
17 lines
441 B
JavaScript
/* eslint-disable no-unused-vars */
|
|
import kolide from '../../kolide';
|
|
import { LOGIN_SUCCESS } from '../nodes/auth/actions';
|
|
import local from '../../utilities/local';
|
|
|
|
const authMiddleware = store => next => action => {
|
|
if (action.type === LOGIN_SUCCESS) {
|
|
const { token } = action.payload.data;
|
|
local.setItem('auth_token', token);
|
|
kolide.setBearerToken(token);
|
|
}
|
|
|
|
return next(action);
|
|
};
|
|
|
|
export default authMiddleware;
|