- The fix is in! Linty fresh and pretty...
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
getNomAvailaibility,
|
||||
loginUser,
|
||||
registerNewUser,
|
||||
setNomDeBid as setNomDeBidApi,
|
||||
} from '../api/profile.js';
|
||||
|
||||
import {
|
||||
@@ -15,11 +16,16 @@ import {
|
||||
PROFILE_NOM_AVAILABLE,
|
||||
REGISTRATION_FAILURE,
|
||||
REGISTRATION_SUCCESS,
|
||||
SET_NOM_FAILURE,
|
||||
SET_NOM_SUCCESS,
|
||||
UNSET_AUTH,
|
||||
UNSET_PROFILE,
|
||||
UPDATE_PROFILE,
|
||||
} from '../constants/actionTypes.js';
|
||||
|
||||
import { getAuthToken } from '../selectors/auth.js';
|
||||
import { getUserId } from '../selectors/profile.js';
|
||||
|
||||
const isValidEmail = (payload) => ({
|
||||
type: PROFILE_EMAIL_AVAILABLE,
|
||||
payload,
|
||||
@@ -44,6 +50,16 @@ const logoutUser = () => ({
|
||||
type: DO_LOGOUT,
|
||||
});
|
||||
|
||||
export const setNomFailure = ({ info }) => ({
|
||||
type: SET_NOM_FAILURE,
|
||||
payload: info,
|
||||
});
|
||||
|
||||
export const setNomSuccess = ({ nomDeBid }) => ({
|
||||
type: SET_NOM_SUCCESS,
|
||||
payload: nomDeBid,
|
||||
});
|
||||
|
||||
const registrationFailure = (payload) => ({
|
||||
type: REGISTRATION_FAILURE,
|
||||
payload,
|
||||
@@ -71,6 +87,15 @@ export const checkEmailAvailability = (email) => (dispatch) => {};
|
||||
|
||||
export const checkNomAvailability = (nomDeBid) => (dispatch) => {};
|
||||
|
||||
export const setNomDeBid = (nomDeBid) => (dispatch, getState) => {
|
||||
const id = getUserId(getState());
|
||||
const auth = getAuthToken(getState());
|
||||
|
||||
setNomDeBidApi({ id, nomDeBid }, auth)
|
||||
.then((result) => dispatch(setNomSuccess(result)))
|
||||
.catch((err) => dispatch(setNomFailure(err)));
|
||||
};
|
||||
|
||||
export const login = (username, password) => (dispatch) => {
|
||||
dispatch(blockUI());
|
||||
loginUser(username, password)
|
||||
|
||||
Reference in New Issue
Block a user