2019-08-31 04:07:25 +05:00
|
|
|
import ActionTypes from '../constants/ActionTypes';
|
|
|
|
|
2022-08-04 13:31:14 +02:00
|
|
|
const authenticate = (data) => ({
|
2019-08-31 04:07:25 +05:00
|
|
|
type: ActionTypes.AUTHENTICATE,
|
|
|
|
payload: {
|
|
|
|
data,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
authenticate.success = (accessToken) => ({
|
|
|
|
type: ActionTypes.AUTHENTICATE__SUCCESS,
|
2019-08-31 04:07:25 +05:00
|
|
|
payload: {
|
|
|
|
accessToken,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2021-06-24 01:05:22 +05:00
|
|
|
authenticate.failure = (error) => ({
|
|
|
|
type: ActionTypes.AUTHENTICATE__FAILURE,
|
2019-08-31 04:07:25 +05:00
|
|
|
payload: {
|
|
|
|
error,
|
|
|
|
},
|
|
|
|
});
|
2021-06-24 01:05:22 +05:00
|
|
|
|
2022-08-04 13:31:14 +02:00
|
|
|
const clearAuthenticateError = () => ({
|
2021-06-24 01:05:22 +05:00
|
|
|
type: ActionTypes.AUTHENTICATE_ERROR_CLEAR,
|
|
|
|
payload: {},
|
|
|
|
});
|
|
|
|
|
2022-08-04 13:31:14 +02:00
|
|
|
export default {
|
|
|
|
authenticate,
|
|
|
|
clearAuthenticateError,
|
|
|
|
};
|