ESlint: application générale des règles
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { ADD_MESSAGE, REMOVE_OLDEST_MESSAGE } from "../actions/message.actions";
|
||||
import { ADD_MESSAGE, REMOVE_OLDEST_MESSAGE } from '../actions/message.actions';
|
||||
|
||||
const initialState = {
|
||||
sortedByTimestamp: []
|
||||
@ -6,11 +6,11 @@ const initialState = {
|
||||
|
||||
export function messagesReducer(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case ADD_MESSAGE:
|
||||
return handleAddMessage(state, action);
|
||||
case REMOVE_OLDEST_MESSAGE:
|
||||
return handleRemoveOldestMessage(state, action);
|
||||
};
|
||||
case ADD_MESSAGE:
|
||||
return handleAddMessage(state, action);
|
||||
case REMOVE_OLDEST_MESSAGE:
|
||||
return handleRemoveOldestMessage(state, action);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -21,12 +21,12 @@ function handleAddMessage(state, action) {
|
||||
{ ts: Date.now(), text: action.text, type: action.messageType },
|
||||
...state.sortedByTimestamp
|
||||
]
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function handleRemoveOldestMessage(state, action) {
|
||||
return {
|
||||
...state,
|
||||
sortedByTimestamp: state.sortedByTimestamp.slice(0, -1)
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
@ -1,15 +1,15 @@
|
||||
import {
|
||||
PROJECT_USER_LIST_SUCCESS,
|
||||
PROJECT_USER_LIST_FAILURE
|
||||
} from '../actions/project'
|
||||
} from '../actions/project';
|
||||
|
||||
const initialState = {
|
||||
items: []
|
||||
}
|
||||
};
|
||||
|
||||
export default (state = initialState, action) => {
|
||||
|
||||
console.log(`Action: ${JSON.stringify(action)}`)
|
||||
console.log(`Action: ${JSON.stringify(action)}`);
|
||||
|
||||
switch (action.type) {
|
||||
|
||||
@ -17,15 +17,15 @@ export default (state = initialState, action) => {
|
||||
return {
|
||||
...state,
|
||||
items: action.projects
|
||||
}
|
||||
};
|
||||
case PROJECT_USER_LIST_FAILURE:
|
||||
return {
|
||||
...state,
|
||||
items: [],
|
||||
error: action.error
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
return state
|
||||
return state;
|
||||
|
||||
}
|
||||
};
|
@ -1,4 +1,4 @@
|
||||
import { LOGIN_SUCCESS, LOGOUT_SUCCESS } from "../actions/auth.actions";
|
||||
import { LOGIN_SUCCESS, LOGOUT_SUCCESS } from '../actions/auth.actions';
|
||||
|
||||
const initialState = {
|
||||
isLoggedIn: false,
|
||||
@ -7,11 +7,11 @@ const initialState = {
|
||||
|
||||
export function sessionReducer(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case LOGIN_SUCCESS:
|
||||
return handleLoginSuccess(state, action);
|
||||
case LOGOUT_SUCCESS:
|
||||
return handleLogoutSuccess(state, action);
|
||||
};
|
||||
case LOGIN_SUCCESS:
|
||||
return handleLoginSuccess(state, action);
|
||||
case LOGOUT_SUCCESS:
|
||||
return handleLogoutSuccess(state, action);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
@ -22,13 +22,13 @@ function handleLoginSuccess(state, action) {
|
||||
user: {
|
||||
username: action.username,
|
||||
},
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
function handleLogoutSuccess(state, action) {
|
||||
return {
|
||||
...state,
|
||||
isLoggedIn: false,
|
||||
user: null,
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { CREATE_USER_FAILURE } from "../actions/user.actions";
|
||||
import { CREATE_USER_FAILURE } from '../actions/user.actions';
|
||||
|
||||
const initialState = {
|
||||
byId: {},
|
||||
@ -7,9 +7,9 @@ const initialState = {
|
||||
|
||||
export function usersReducer(state = initialState, action) {
|
||||
switch(action.type) {
|
||||
case CREATE_USER_FAILURE:
|
||||
return handleCreateUserFailure(state, action);
|
||||
};
|
||||
case CREATE_USER_FAILURE:
|
||||
return handleCreateUserFailure(state, action);
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user